private void unsupported(String message) { this.status.unsupportedMediaType(message); }
private void unsupported(String message, Status status, Object... params) { status.unsupportedMediaType(String.format(message, params)); } }
@Test public void willSetHttpStatusCode415IfTheResourceMethodDoesNotSupportTheGivenMediaTypes() throws Exception { when(request.getContentType()).thenReturn("image/jpeg"); interceptor.intercept(stack, consumeXml, null); verify(status).unsupportedMediaType("Request with media type [image/jpeg]. Expecting one of [application/xml]."); verifyZeroInteractions(stack); }
@Test public void willSetHttpStatusCode415IfThereIsNoDeserializerButIsAccepted() throws Exception { when(request.getContentType()).thenReturn("application/xml"); when(deserializers.deserializerFor("application/xml", container)).thenReturn(null); interceptor.intercept(stack, consumeXml, null); verify(status).unsupportedMediaType("Unable to handle media type [application/xml]: no deserializer found."); verifyZeroInteractions(stack); }