@Test public void shouldBeEqualIfHasSameFirstSecondAndThird() { // Given Triple<Integer, String, Boolean> triple1 = tuple(5, "Five", true); Triple<Integer, String, Boolean> triple2 = tuple(5, "Five", true); // When Boolean isEqual = triple1.equals(triple2); // Then assertThat(isEqual, is(true)); }
@Test public void shouldNotBeEqualIfHasDifferentThird() { // Given Triple<Integer, String, Boolean> triple1 = tuple(5, "Five", true); Triple<Integer, String, Boolean> triple2 = tuple(5, "Five", false); // When Boolean isEqual = triple1.equals(triple2); // Then assertThat(isEqual, is(false)); }
@Test public void shouldNotBeEqualIfNotATriple() throws Exception { // Given Triple<Integer, String, Boolean> triple = tuple(5, "Five", true); Iterable<Object> iterable = iterableBuilderOf(Object.class).with(5, "five", true).build(); // When boolean firstDirection = triple.equals(iterable); boolean secondDirection = iterable.equals(triple); // Then assertThat(firstDirection, is(false)); assertThat(secondDirection, is(false)); }