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 guava by hceylan.
the class OrderingTest method testFrom.
public void testFrom() {
Ordering<String> caseInsensitiveOrdering = Ordering.from(String.CASE_INSENSITIVE_ORDER);
assertEquals(0, caseInsensitiveOrdering.compare("A", "a"));
assertTrue(caseInsensitiveOrdering.compare("a", "B") < 0);
assertTrue(caseInsensitiveOrdering.compare("B", "a") > 0);
// test of deprecated method
@SuppressWarnings("deprecation") Ordering<String> orderingFromOrdering = Ordering.from(Ordering.<String>natural());
new EqualsTester().addEqualityGroup(caseInsensitiveOrdering, Ordering.from(String.CASE_INSENSITIVE_ORDER)).addEqualityGroup(orderingFromOrdering, Ordering.natural()).testEquals();
}
use of com.google.common.testing.EqualsTester in project guava by hceylan.
the class BloomFilterTest method testEquals.
public void testEquals() {
BloomFilter<CharSequence> bf1 = BloomFilter.create(Funnels.stringFunnel(), 100);
bf1.put("1");
bf1.put("2");
BloomFilter<CharSequence> bf2 = BloomFilter.create(Funnels.stringFunnel(), 100);
bf2.put("1");
bf2.put("2");
new EqualsTester().addEqualityGroup(bf1, bf2).testEquals();
bf2.put("3");
new EqualsTester().addEqualityGroup(bf1).addEqualityGroup(bf2).testEquals();
}
use of com.google.common.testing.EqualsTester in project google-cloud-java by GoogleCloudPlatform.
the class StatementTest method equalsAndHashCode.
@Test
public void equalsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(Statement.of("SELECT 1"), Statement.of("SELECT 1"), Statement.newBuilder("SELECT ").append("1").build());
tester.addEqualityGroup(Statement.of("SELECT 2"));
// Note that some of the following are incomplete bindings: they would fail if executed.
tester.addEqualityGroup(Statement.newBuilder("SELECT @x, @y").bind("x").to(1).build(), Statement.newBuilder("SELECT @x, @y").bind("x").to(1).build());
tester.addEqualityGroup(Statement.newBuilder("SELECT @x, @y").bind("x").to("1").build());
tester.addEqualityGroup(Statement.newBuilder("SELECT @x, @y").bind("x").to(2).build());
tester.addEqualityGroup(Statement.newBuilder("SELECT @x, @y").bind("y").to(2).build());
tester.addEqualityGroup(Statement.newBuilder("SELECT @x, @y").bind("x").to(1).bind("y").to(2).build());
tester.testEquals();
}
use of com.google.common.testing.EqualsTester in project google-cloud-java by GoogleCloudPlatform.
the class StructTest method equalsAndHashCode.
@Test
public void equalsAndHashCode() {
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(Struct.newBuilder().build(), Struct.newBuilder().build());
tester.addEqualityGroup(Struct.newBuilder().set("x").to(1).build(), Struct.newBuilder().add("x", Value.int64(1)).build());
tester.addEqualityGroup(Struct.newBuilder().set("x").to((Long) null).build());
tester.addEqualityGroup(Struct.newBuilder().set("x").to((String) null).build());
tester.addEqualityGroup(Struct.newBuilder().set("x").to(1).set("y").to(2).build());
tester.addEqualityGroup(Struct.newBuilder().set("x").to(1).set("y").to("2").build());
tester.addEqualityGroup(Struct.newBuilder().set("y").to(2).set("x").to(1).build());
tester.testEquals();
}
Aggregations