Jersey test - ExceptionMapper is not invoked
<p>I have REST web service which I test with Jersey Test, Mockito, Junit. When web service method is executed successfully, I get correct response. In case of invalid data, custom exception is thrown which must be handled by ExceptionMapper. It should return the same structure response but with different codes. ExceptionMapper works well in not test environment. However, after test execution logs show:</p>

<pre><code>1 &lt; 500
1 &lt; Connection: close
1 &lt; Content-Length: 1033
1 &lt; Content-Type: text/html;charset=ISO-8859-1
1 &lt; Date: Wed, 30 Mar 2016 11:55:37 GMT

javax.ws.rs.InternalServerErrorException: HTTP 500 Request failed.
at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1020)
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:816)
at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92)
</code></pre>

<p>I use:</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.glassfish.jersey.test-framework.providers&lt;/groupId&gt;
    &lt;artifactId&gt;jersey-test-framework-provider-grizzly2&lt;/artifactId&gt;
    &lt;version&gt;2.22.2&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<p>Shortened version of mocked service which is extented by test classes:</p>

<pre><code>public class MockedService extends JerseyTest {

    @Override
    public ResourceConfig configure() {

        forceSet(TestProperties.CONTAINER_PORT, "8080");
        enable(TestProperties.LOG_TRAFFIC);

        return new ResourceConfig().register(new Service());
    }
}
</code></pre>

<p>How to get response from ExceptionMapper?</p>