use of org.springframework.web.HttpMediaTypeNotSupportedException in project spring-framework by spring-projects.
the class DefaultHandlerExceptionResolverTests method handleHttpMediaTypeNotSupported.
@Test
public void handleHttpMediaTypeNotSupported() {
HttpMediaTypeNotSupportedException ex = new HttpMediaTypeNotSupportedException(new MediaType("text", "plain"), Collections.singletonList(new MediaType("application", "pdf")));
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertNotNull("No ModelAndView returned", mav);
assertTrue("No Empty ModelAndView returned", mav.isEmpty());
assertEquals("Invalid status code", 415, response.getStatus());
assertEquals("Invalid Accept header", "application/pdf", response.getHeader("Accept"));
}
Aggregations