use of javax.ws.rs.container.ContainerRequestContext in project graylog2-server by Graylog2.
the class MessageExportFormatFilterTest method mockRequestContext.
private ContainerRequestContext mockRequestContext(List<MediaType> acceptedMediaTypes) {
final UriInfo uriInfo = uriInfo(VALID_PATH);
final ContainerRequestContext requestContext = mock(ContainerRequestContext.class);
when(requestContext.getAcceptableMediaTypes()).thenReturn(acceptedMediaTypes);
when(requestContext.getUriInfo()).thenReturn(uriInfo);
final MultivaluedMap<String, String> headers = new MultivaluedStringMap(1);
headers.put(HttpHeaders.ACCEPT, acceptedMediaTypes.stream().map(MediaType::toString).collect(Collectors.toList()));
when(requestContext.getHeaders()).thenReturn(headers);
return requestContext;
}
Aggregations