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 static javax.ws.rs.core.Response.Status.NOT_FOUND; 009import static org.junit.Assert.assertEquals; 010 011import javax.ws.rs.core.Response; 012import org.fcrepo.kernel.api.exception.ItemNotFoundException; 013import org.junit.Before; 014import org.junit.Test; 015 016 017/** 018 * ItemNotFoundExceptionMapperTest class. 019 * 020 * @author pwinckles 021 */ 022public class ItemNotFoundExceptionMapperTest { 023 024 private ItemNotFoundExceptionMapper testObj; 025 026 @Before 027 public void setUp() { 028 testObj = new ItemNotFoundExceptionMapper(); 029 } 030 031 @Test 032 public void testToResponse() { 033 final ItemNotFoundException input = new ItemNotFoundException("xyz"); 034 final Response actual = testObj.toResponse(input); 035 assertEquals(NOT_FOUND.getStatusCode(), actual.getStatus()); 036 assertEquals(actual.getEntity(), "Error: xyz"); 037 } 038}