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; 012 013import org.fcrepo.kernel.api.exception.PathNotFoundException; 014 015import org.junit.Before; 016import org.junit.Test; 017 018 019/** 020 * PathNotFoundExceptionMapperTest class. 021 * 022 * @author robyj 023 */ 024public class PathNotFoundExceptionMapperTest { 025 026 private PathNotFoundExceptionMapper testObj; 027 028 @Before 029 public void setUp() { 030 testObj = new PathNotFoundExceptionMapper(); 031 } 032 033 @Test 034 public void testToResponse() { 035 final PathNotFoundException input = new PathNotFoundException("xyz"); 036 final Response actual = testObj.toResponse(input); 037 assertEquals(NOT_FOUND.getStatusCode(), actual.getStatus()); 038 assertEquals(actual.getEntity(), "Error: xyz"); 039 } 040}