Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Fix for Issue#11 increase test coverage for jaeger-jaxrs2 tests #162

Merged
merged 4 commits into from
May 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

package com.uber.jaeger.filters.jaxrs2;

import static com.uber.jaeger.filters.jaxrs2.Constants.CURRENT_SPAN_CONTEXT_KEY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.when;

import com.uber.jaeger.Span;
Expand Down Expand Up @@ -84,6 +87,8 @@ public void testFilter() throws Exception {

undertest.filter(clientRequestContext);

assertNull(clientRequestContext.getProperty(CURRENT_SPAN_CONTEXT_KEY));

ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<Object> objectCaptor = ArgumentCaptor.forClass(Object.class);

Expand All @@ -94,6 +99,8 @@ public void testFilter() throws Exception {

undertest.filter(clientRequestContext, clientResponseContext);

assertNotNull(clientRequestContext.getProperty(CURRENT_SPAN_CONTEXT_KEY));

List<Span> spans = reporter.getSpans();
Map<String, Object> tags = spans.get(0).getTags();
assertEquals(200, tags.get(Tags.HTTP_STATUS.getKey()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,13 @@ public void filter() throws Exception {
assertEquals(Tags.SPAN_KIND_SERVER, tags.get(Tags.SPAN_KIND.getKey()));
assertEquals(uri.toString(), tags.get(Tags.HTTP_URL.getKey()));
assertEquals("localhost", tags.get(Tags.PEER_HOSTNAME.getKey()));


// Exercise catch blocks on filter methods for code coverage
undertest.filter(null);

// For filter(requestContext, responseContext) we first need to make sure there's something in the traceContext
undertest.filter(containerRequestContext);
undertest.filter(containerRequestContext, null);
}
}