use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.
the class LinkTest method link_EqualsAndHashCode.
@Test
public void link_EqualsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(Link.fromSpanContext(spanContext, Type.PARENT), Link.fromSpanContext(spanContext, Type.PARENT)).addEqualityGroup(Link.fromSpanContext(spanContext, Type.CHILD), Link.fromSpanContext(spanContext, Type.CHILD)).addEqualityGroup(Link.fromSpanContext(SpanContext.INVALID, Type.CHILD)).addEqualityGroup(Link.fromSpanContext(SpanContext.INVALID, Type.PARENT));
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.
the class AnnotationTest method annotation_EqualsAndHashCode.
@Test
public void annotation_EqualsAndHashCode() {
EqualsTester tester = new EqualsTester();
Map<String, AttributeValue> attributes = new HashMap<String, AttributeValue>();
attributes.put("MyStringAttributeKey", AttributeValue.stringAttributeValue("MyStringAttributeValue"));
tester.addEqualityGroup(Annotation.fromDescription("MyAnnotationText"), Annotation.fromDescriptionAndAttributes("MyAnnotationText", Collections.<String, AttributeValue>emptyMap())).addEqualityGroup(Annotation.fromDescriptionAndAttributes("MyAnnotationText", attributes), Annotation.fromDescriptionAndAttributes("MyAnnotationText", attributes)).addEqualityGroup(Annotation.fromDescription("MyAnnotationText2"));
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.
the class TraceIdTest method traceId_EqualsAndHashCode.
@Test
public void traceId_EqualsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(TraceId.INVALID, TraceId.INVALID);
tester.addEqualityGroup(first, TraceId.fromBytes(Arrays.copyOf(firstBytes, firstBytes.length)));
tester.addEqualityGroup(second, TraceId.fromBytes(Arrays.copyOf(secondBytes, secondBytes.length)));
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.
the class TraceOptionsTest method traceOptions_EqualsAndHashCode.
@Test
public void traceOptions_EqualsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(TraceOptions.DEFAULT);
tester.addEqualityGroup(TraceOptions.fromBytes(secondBytes), TraceOptions.builder().setIsSampled().build());
tester.addEqualityGroup(TraceOptions.fromBytes(firstBytes));
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.
the class SpanDataTest method spanDataEquals.
@Test
public void spanDataEquals() {
SpanData allSpanData1 = SpanData.create(spanContext, parentSpanId, false, DISPLAY_NAME, startTimestamp, attributes, annotations, networkEvents, links, status, endTimestamp);
SpanData allSpanData2 = SpanData.create(spanContext, parentSpanId, false, DISPLAY_NAME, startTimestamp, attributes, annotations, networkEvents, links, status, endTimestamp);
SpanData emptySpanData = SpanData.create(spanContext, parentSpanId, false, DISPLAY_NAME, startTimestamp, Attributes.create(Collections.<String, AttributeValue>emptyMap(), 0), TimedEvents.create(Collections.<SpanData.TimedEvent<Annotation>>emptyList(), 0), TimedEvents.create(Collections.<SpanData.TimedEvent<NetworkEvent>>emptyList(), 0), Links.create(Collections.<Link>emptyList(), 0), status, endTimestamp);
new EqualsTester().addEqualityGroup(allSpanData1, allSpanData2).addEqualityGroup(emptySpanData).testEquals();
}
Aggregations