Tuple1 { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || !Objects.equals(getClass(), o.getClass())) { return false; } final Tuple1<?> tuple1 = (Tuple1<?>) o; return Objects.equals(_1, tuple1._1); } Tuple1(T1 t1); T1 _1(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test void equals() { Tuple1 tuple = Tuple.of(1); SoftAssertions.assertSoftly(softly -> { softly.assertThat(tuple) .isEqualTo(tuple); softly.assertThat(tuple) .isNotEqualTo(null); softly.assertThat(tuple) .isNotEqualTo(""); }); Tuple1 tuple2 = Tuple.of(1); SoftAssertions.assertSoftly(softly -> { softly.assertThat(tuple) .isNotSameAs(tuple2); softly.assertThat(tuple) .isEqualTo(tuple2); }); Tuple1 tuple3 = Tuple.of(2); SoftAssertions.assertSoftly(softly -> { softly.assertThat(tuple3) .isNotEqualTo(tuple); softly.assertThat(tuple) .isNotEqualTo(tuple3); }); }