public void testCollectWithDefaultAnnotation() throws TTransportException {
final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT);
zipkinSpanCollector.addDefaultAnnotation(KEY1, VALUE1);
try {
final Span span = new Span();
span.setId(SPAN_ID);
span.setTrace_id(TRACE_ID);
span.setName(SPAN_NAME);
zipkinSpanCollector.collect(span);
} finally {
zipkinSpanCollector.close();
}
final List<Span> serverCollectedSpans = zipkinCollectorServer.getReceivedSpans();
assertEquals(1, serverCollectedSpans.size());
final Span span = serverCollectedSpans.get(0);
assertEquals(SPAN_ID, span.getId());
assertEquals(TRACE_ID, span.getTrace_id());
assertEquals(SPAN_NAME, span.getName());
final List<BinaryAnnotation> binary_annotations = span.getBinary_annotations();
assertEquals("Expect default annotation to have been submitted.", 1, binary_annotations.size());
final BinaryAnnotation binaryAnnotation = binary_annotations.get(0);
assertEquals(KEY1, binaryAnnotation.getKey());
assertEquals(VALUE1, new String(binaryAnnotation.getValue()));