use of com.google.common.testing.EqualsTester in project core-java by SpineEventEngine.
the class EntityRecordWithColumnsShould method have_equals.
@Test
public void have_equals() {
final MemoizedValue mockValue = mock(MemoizedValue.class);
final EntityRecordWithColumns noFieldsEnvelope = of(EntityRecord.getDefaultInstance());
final EntityRecordWithColumns emptyFieldsEnvelope = of(EntityRecord.getDefaultInstance(), Collections.<String, MemoizedValue>emptyMap());
final EntityRecordWithColumns notEmptyFieldsEnvelope = of(EntityRecord.getDefaultInstance(), singletonMap("key", mockValue));
new EqualsTester().addEqualityGroup(noFieldsEnvelope, emptyFieldsEnvelope, notEmptyFieldsEnvelope).addEqualityGroup(newRecord()).addEqualityGroup(// Each one has different EntityRecord
newRecord()).testEquals();
}
use of com.google.common.testing.EqualsTester in project core-java by SpineEventEngine.
the class QueryParametersShould method support_equality.
@Test
public void support_equality() {
// --- Group A ---
// Consists of 2 empty instances
final QueryParameters paramsA1 = newBuilder().build();
final QueryParameters paramsA2 = newBuilder().build();
// --- Group B ---
// Consists of 3 instances with a single filter targeting a String column
final EntityColumn bColumn = mockColumn();
final ColumnFilter bFilter = ColumnFilters.eq("b", "c");
final QueryParameters paramsB1 = newBuilder().add(aggregatingParameter(bColumn, bFilter)).build();
final QueryParameters paramsB2 = newBuilder().add(aggregatingParameter(bColumn, bFilter)).build();
final QueryParameters paramsB3 = newBuilder().add(aggregatingParameter(bColumn, bFilter)).build();
// --- Group C ---
// Consists of an instance with a single filter targeting an integer number column
final EntityColumn cColumn = mockColumn();
final ColumnFilter cFilter = ColumnFilters.eq("a", 42);
final QueryParameters paramsC = newBuilder().add(aggregatingParameter(cColumn, cFilter)).build();
// --- Check ---
new EqualsTester().addEqualityGroup(paramsA1, paramsA2).addEqualityGroup(paramsB1, paramsB2, paramsB3).addEqualityGroup(paramsC).testEquals();
}
use of com.google.common.testing.EqualsTester in project core-java by SpineEventEngine.
the class StorageSpecShould method provide_equals_based_on_values.
@Test
public void provide_equals_based_on_values() {
final BoundedContextName bcName = newName(getClass().getName());
new EqualsTester().addEqualityGroup(StorageSpec.of(bcName, TypeUrl.of(StringValue.class), String.class), StorageSpec.of(bcName, TypeUrl.of(StringValue.class), String.class)).addEqualityGroup(StorageSpec.of(bcName, TypeUrl.of(Timestamp.class), Integer.class), StorageSpec.of(bcName, TypeUrl.of(Timestamp.class), Integer.class)).testEquals();
}
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();
}
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();
}
Aggregations