use of io.opencensus.contrib.http.jaxrs.JaxrsClientFilterTest.FakeSpan in project instrumentation-java by census-instrumentation.
the class JaxrsContainerFilterTest method testResponseFilter.
@Test
public void testResponseFilter() throws Exception {
Span span = new FakeSpan(SpanContext.INVALID, null);
TagContext tagContext = mock(TagContext.class);
HttpRequestContext context = JaxrsClientFilterTest.createHttpRequestContext(span, tagContext);
UriInfo uriInfo = mock(UriInfo.class);
when(uriInfo.getMatchedURIs()).thenReturn(Collections.singletonList("/resource/{route}"));
ContainerRequestContext requestContext = mock(ContainerRequestContext.class);
when(requestContext.getProperty("opencensus.context")).thenReturn(context);
when(requestContext.getUriInfo()).thenReturn(uriInfo);
ContainerResponseContext responseContext = mock(ContainerResponseContext.class);
filter.filter(requestContext, responseContext);
verify(requestContext).getProperty("opencensus.context");
verify(responseContext, times(1)).getStatus();
}
Aggregations