use of io.vertx.ext.web.ParsedHeaderValues in project hono by eclipse.
the class AbstractVertxBasedHttpProtocolAdapterTest method newHttpContext.
private HttpContext newHttpContext(final Buffer payload, final String contentType, final HttpServerRequest request, final HttpServerResponse response) {
when(response.setStatusCode(anyInt())).thenReturn(response);
when(response.closed()).thenReturn(false);
final RoutingContext ctx = mock(RoutingContext.class);
when(ctx.getBody()).thenReturn(payload);
when(ctx.response()).thenReturn(response);
when(ctx.request()).thenReturn(request);
when(ctx.get(TracingHandler.CURRENT_SPAN)).thenReturn(mock(Span.class));
when(ctx.vertx()).thenReturn(vertx);
when(ctx.get(CommandContext.KEY_COMMAND_CONTEXT)).thenReturn(null);
when(ctx.get(MetricsTags.TtdStatus.class.getName())).thenReturn(MetricsTags.TtdStatus.NONE);
if (contentType != null) {
final MIMEHeader headerContentType = mock(MIMEHeader.class);
when(headerContentType.value()).thenReturn(contentType);
final ParsedHeaderValues headers = mock(ParsedHeaderValues.class);
when(headers.contentType()).thenReturn(headerContentType);
when(ctx.parsedHeaders()).thenReturn(headers);
}
return HttpContext.from(ctx);
}
Aggregations