RecommendedParticipation implements Recommended<RecommendedParticipation, ParticipationDescriptor, Participation> { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || !Objects.equals(getClass(), o.getClass())) { return false; } final RecommendedParticipation that = (RecommendedParticipation) o; return Objects.equals(participationDescriptor, that.participationDescriptor); } RecommendedParticipation(final ParticipationDescriptor participationDescriptor); @Override ParticipationDescriptor descriptor(); @Override Money amount(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test void equals() { final Participation p = mockParticipation(); final ParticipationDescriptor d = new ParticipationDescriptor(p, () -> LOAN); final RecommendedParticipation r = new RecommendedParticipation(d); assertSoftly(softly -> { softly.assertThat(r) .isNotEqualTo(null); softly.assertThat(r) .isNotEqualTo(UUID.randomUUID() .toString()); softly.assertThat(r) .isEqualTo(r); }); final RecommendedParticipation r2 = new RecommendedParticipation(d); assertSoftly(softly -> { softly.assertThat(r) .isEqualTo(r2); softly.assertThat(r2) .isEqualTo(r); }); final RecommendedParticipation r3 = new RecommendedParticipation( new ParticipationDescriptor(mockParticipation(), () -> LOAN)); assertThat(r).isNotEqualTo(r3); }