Span implements Serializable { public MappingResult binaryAnnotationMapping() { return mappingResult; } Span(); @JsonCreator  Span(@JsonProperty("binaryAnnotations") List<BinaryAnnotation> binaryAnnotations,
                @JsonProperty("annotations") List<Annotation> annotations);  Span(Span span, List<BinaryAnnotation> binaryAnnotations, List<Annotation> annotations); String getTraceId(); void setTraceId(String traceId); String getName(); void setName(String name); String getId(); void setId(String id); String getParentId(); void setParentId(String parentId); List<Annotation> getAnnotations(); List<BinaryAnnotation> getBinaryAnnotations(); Boolean getDebug(); void setDebug(Boolean debug); Long getTimestamp(); void setTimestamp(Long timestamp); Long getDuration(); void setDuration(Long duration); boolean topLevelSpan(); boolean clientSpan(); boolean serverSpan(); BinaryAnnotation getBinaryAnnotation(String key); MappingResult binaryAnnotationMapping(); String ipv4(); String service(); URL url(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testSerialization() throws IOException, ClassNotFoundException { BinaryAnnotationMappingDeriver.clearStorage(); String testResourcesPath = getClass().getClassLoader().getResource(".").getPath(); BinaryAnnotationMappingDeriver.getInstance(testResourcesPath + "test-binary-annotations-mapping.json"); BinaryAnnotation stringAnnotation = new BinaryAnnotation(); stringAnnotation.setKey("ignore.key"); stringAnnotation.setValue("ignore.value"); stringAnnotation.setEndpoint(createEndpoint("bonjour", "127.0.0.2", (short)8090)); stringAnnotation.setType(AnnotationType.STRING); BinaryAnnotation binaryAnnotationWithMapping = new BinaryAnnotation(); binaryAnnotationWithMapping.setKey("foo"); binaryAnnotationWithMapping.setValue("value"); binaryAnnotationWithMapping.setEndpoint(createEndpoint("bonjour2", "127.0.1.2", (short)8090)); binaryAnnotationWithMapping.setType(AnnotationType.DOUBLE); Span span = new Span(Arrays.asList(stringAnnotation, binaryAnnotationWithMapping), serverAnnotations()); Span deserializedSpan = (Span)deserialize(serialize(span)); Assert.assertEquals(span, deserializedSpan); Assert.assertEquals(new HashSet<>(Arrays.asList( new Property("foo.prop", "value", PropertyType.Number))), new HashSet<>(deserializedSpan.binaryAnnotationMapping().getProperties())); Assert.assertEquals("foo.modified", deserializedSpan.binaryAnnotationMapping().getComponentType()); Assert.assertEquals("foo.endpoint", deserializedSpan.binaryAnnotationMapping().getEndpointType()); }