Search in sources :

Example 76 with EqualsTester

use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.

the class DistributionAggregationTest method testDistributionAggregationEquals.

@Test
public void testDistributionAggregationEquals() {
    List<Long> buckets = Arrays.asList(1L, 2L, 3L);
    new EqualsTester().addEqualityGroup(DistributionAggregation.create(10, 5.0, 30.0, Range.create(1.0, 5.0), TAGS), DistributionAggregation.create(10, 5.0, 30.0, Range.create(1.0, 5.0), TAGS)).addEqualityGroup(DistributionAggregation.create(10, 5.0, 30.0, Range.create(1.0, 5.0), TAGS, buckets), DistributionAggregation.create(10, 5.0, 30.0, Range.create(1.0, 5.0), TAGS, buckets)).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) Test(org.junit.Test)

Example 77 with EqualsTester

use of com.google.common.testing.EqualsTester in project instrumentation-java by census-instrumentation.

the class DistributionTest method testDistributionEquals.

@Test
public void testDistributionEquals() {
    BucketBoundaries boundaries = BucketBoundaries.create(Arrays.asList(-10.0, 10.0));
    MutableDistribution mDistribution = MutableDistribution.create(boundaries);
    mDistribution.add(1);
    mDistribution.add(-1);
    Distribution distribution1 = Distribution.create(mDistribution);
    Distribution distribution2 = Distribution.create(mDistribution);
    mDistribution.add(0);
    Distribution distribution3 = Distribution.create(mDistribution);
    new EqualsTester().addEqualityGroup(distribution1, distribution2).addEqualityGroup(distribution3).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) Test(org.junit.Test)

Example 78 with EqualsTester

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();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) Test(org.junit.Test)

Example 79 with EqualsTester

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();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 80 with EqualsTester

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();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) Test(org.junit.Test)

Aggregations

EqualsTester (com.google.common.testing.EqualsTester)177 Test (org.junit.Test)83 GwtIncompatible (com.google.common.annotations.GwtIncompatible)10 ParameterizedType (java.lang.reflect.ParameterizedType)10 WildcardType (java.lang.reflect.WildcardType)8 Method (java.lang.reflect.Method)7 Entry (java.util.Map.Entry)7 GenericArrayType (java.lang.reflect.GenericArrayType)6 Type (java.lang.reflect.Type)6 ImmutableList (com.google.common.collect.ImmutableList)5 Path (com.google.devtools.build.lib.vfs.Path)5 List (java.util.List)5 Set (java.util.Set)5 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)4 HashMap (java.util.HashMap)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 Label (com.google.devtools.build.lib.cmdline.Label)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3