### Question:
LotteryTicket { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } var other = (LotteryTicket) obj; if (lotteryNumbers == null) { if (other.lotteryNumbers != null) { return false; } } else if (!lotteryNumbers.equals(other.lotteryNumbers)) { return false; } if (playerDetails == null) { return other.playerDetails == null; } else { return playerDetails.equals(other.playerDetails); } } LotteryTicket(LotteryTicketId id, PlayerDetails details, LotteryNumbers numbers); PlayerDetails getPlayerDetails(); LotteryNumbers getNumbers(); LotteryTicketId getId(); void setId(LotteryTicketId id); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test void testEquals() { var details1 = new PlayerDetails("bob@foo.bar", "1212-121212", "+34332322"); var numbers1 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); var ticket1 = new LotteryTicket(new LotteryTicketId(), details1, numbers1); var details2 = new PlayerDetails("bob@foo.bar", "1212-121212", "+34332322"); var numbers2 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); var ticket2 = new LotteryTicket(new LotteryTicketId(), details2, numbers2); assertEquals(ticket1, ticket2); var details3 = new PlayerDetails("elsa@foo.bar", "1223-121212", "+49332322"); var numbers3 = LotteryNumbers.create(Set.of(1, 2, 3, 8)); var ticket3 = new LotteryTicket(new LotteryTicketId(), details3, numbers3); assertNotEquals(ticket1, ticket3); }