@Test()
public void testValidateRequestHeadersWithValidAcceptHeaderAndNoMatch() throws Exception
{
Map<String, String> headers = new HashMap<String, String>();
headers.put("Accept", "text/html");
ServerResourceContext resourceContext = new ResourceContextImpl();
try
{
RestUtils.validateRequestHeadersAndUpdateResourceContext(headers, resourceContext);
fail();
}
catch (RestLiServiceException e)
{
Assert.assertEquals(e.getStatus(), HttpStatus.S_406_NOT_ACCEPTABLE);
Assert.assertEquals(e.getMessage(),
"None of the types in the request's 'Accept' header are supported. Supported MIME types are: [application/x-pson, application/json]");
Assert.assertEquals(resourceContext.getResponseMimeType(), null);
}
}