@@ -0,0 +1,1514 @@
+package com.coding4people.mosquitoreport.api.exceptionmappers;%0D%0A%0D%0Aimport static org.junit.Assert.assertEquals;%0D%0A%0D%0Aimport javax.ws.rs.BadRequestException;%0D%0Aimport javax.ws.rs.GET;%0D%0Aimport javax.ws.rs.Path;%0D%0Aimport javax.ws.rs.Produces;%0D%0Aimport javax.ws.rs.core.Response;%0D%0A%0D%0Aimport org.glassfish.jersey.server.ResourceConfig;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport com.coding4people.mosquitoreport.api.WithServer;%0D%0Aimport com.fasterxml.jackson.databind.node.ObjectNode;%0D%0A%0D%0Apublic class BadRequestExceptionMapperTest extends WithServer %7B%0D%0A%0D%0A    @Path(%22/bad-request%22)%0D%0A    public static class TestErrorController %7B%0D%0A        @GET%0D%0A        @Produces(%22application/json;charset=UTF-8%22)%0D%0A        public String producesInternalServerError() %7B%0D%0A            throw new BadRequestException(%22fake message%22);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected ResourceConfig configure() %7B%0D%0A        return super.configure().register(TestErrorController.class).register(BadRequestExceptionMapper.class);%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void testMissingParameter() %7B%0D%0A        Response response = target().path(%22/bad-request%22).request().get();%0D%0A%0D%0A        assertEquals(400, response.getStatus());%0D%0A        assertEquals(%22application/json;charset=UTF-8%22, response.getHeaderString(%22Content-type%22));%0D%0A        %0D%0A        ObjectNode ObjectNode = response.readEntity(ObjectNode.class);%0D%0A        %0D%0A        assertEquals(%22error%22, ObjectNode.get(%22status%22).asText());%0D%0A        assertEquals(%22fake message%22, ObjectNode.get(%22message%22).asText());%0D%0A    %7D%0D%0A%7D%0D%0A

Test BadRequestExceptionMapper