use of com.google.common.testing.EqualsTester in project google-cloud-java by GoogleCloudPlatform.
the class TimestampTest method equalsAndHashCode.
@Test
public void equalsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0), Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0), Timestamp.of(new java.sql.Timestamp(TEST_TIME_SECONDS * 1000)));
tester.addEqualityGroup(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS + 1, 0));
tester.addEqualityGroup(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 1));
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project core-java by SpineEventEngine.
the class MessageEnvelopeShould method support_equality.
@Test
public void support_equality() {
final O oneMessage = outerObject();
final O anotherMessage = outerObject();
final E oneEnvelope = toEnvelope(oneMessage);
final E anotherEnvelope = toEnvelope(anotherMessage);
new EqualsTester().addEqualityGroup(oneEnvelope).addEqualityGroup(anotherEnvelope).testEquals();
}
use of com.google.common.testing.EqualsTester in project core-java by SpineEventEngine.
the class EntityQueryShould method support_equality.
@Test
public void support_equality() {
final EqualsTester tester = new EqualsTester();
addEqualityGroupA(tester);
addEqualityGroupB(tester);
addEqualityGroupC(tester);
addEqualityGroupD(tester);
tester.testEquals();
}
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();
}
Aggregations