001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006package org.fcrepo.http.commons.exceptionhandlers; 007 008import org.glassfish.jersey.server.ParamException; 009import org.junit.Before; 010import org.junit.Test; 011 012import javax.ws.rs.core.Response; 013 014import static org.junit.Assert.assertEquals; 015import static org.junit.Assert.assertNotNull; 016 017/** 018 * {@link org.fcrepo.http.commons.exceptionhandlers.ParamExceptionMapper} 019 * 020 * @author awoods 021 * @since 2015-01-20 022 */ 023public class ParamExceptionMapperTest { 024 025 private ParamExceptionMapper testObj; 026 027 @Before 028 public void setUp() { 029 testObj = new ParamExceptionMapper(); 030 } 031 032 @Test 033 public void testToResponse() { 034 final ParamException input = new ParamException.HeaderParamException(new RuntimeException("canned-exception"), 035 "test-header", 036 null); 037 final Response actual = testObj.toResponse(input); 038 assertEquals(input.getResponse().getStatus(), actual.getStatus()); 039 assertNotNull(actual.getEntity()); 040 } 041}