public Object answer(final InvocationOnMock invocation) throws Throwable {
try {
return answerGet(server, s).getEntity();
} catch (final WebApplicationException e) {
assertEquals(e.getResponse().getStatus(), 404);
throw new UniformInterfaceException404NotFound(new ClientResponse(404, null, null, null), false);
}
}
});
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(final InvocationOnMock invocation) throws Throwable {
try {
return answerPost(server, invocation.getArguments()[0], s).getEntity();
} catch (final WebApplicationException e) {
assertEquals(e.getResponse().getStatus(), 404);
throw new UniformInterfaceException404NotFound(new ClientResponse(404, null, null, null), false);
}
}
}).when(builder).post(Mockito.any());
return builder;
}