I have a script that ExceptionMapperuses JAX-RS using RESTeasy 2.0.1.GA. It works great.
Now I would like to test everything using the RESTeasy mock mechanism . Unfortunately, my ExceptionMapper provider is not registered. What am I missing?
POJOResourceFactory factory = new POJOResourceFactory(SomeWebResource.class);
Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
dispatcher.getRegistry().addResourceFactory(factory);
MockHttpRequest request = MockHttpRequest.get("url");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
Assert.assertEquals(response.getStatus(), 404);
source
share