@Test
public void testJsonSerializationWithOptionalFields() throws Exception {
MilliSpan.Builder builder = new MilliSpan.Builder().
description("foospan").
begin(300).
end(400).
parents(new SpanId[] { }).
tracerId("b2408.halxg.com:8080").
spanId(new SpanId(111111111L, 111111111L));
Map<String, String> traceInfo = new HashMap<String, String>();
traceInfo.put("abc", "123");
traceInfo.put("def", "456");
builder.traceInfo(traceInfo);
List<TimelineAnnotation> timeline = new LinkedList<TimelineAnnotation>();
timeline.add(new TimelineAnnotation(310L, "something happened"));
timeline.add(new TimelineAnnotation(380L, "something else happened"));
timeline.add(new TimelineAnnotation(390L, "more things"));
builder.timeline(timeline);
MilliSpan span = builder.build();
String json = span.toJson();
MilliSpan dspan = MilliSpan.fromJson(json);
compareSpans(span, dspan);
}