### Question:
User implements Principal, PersistentObject<String> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } User user = (User) o; return new EqualsBuilder().append(username, user.username).isEquals(); } User();  User(String username);  User(String username, String password); @Override boolean equals(Object o); @Override int hashCode(); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); @Override @JsonIgnore String getName(); @Override String getId(); void setRoles(List<String> roles); boolean hasRole(String role); boolean isShadow(); void setShadow(boolean shadow); String getFullName(); void setEmail(String email); void setFullName(String fullName); String getEmail();  }### Answer:
@Test void testEquals() { var user = new User(); user.setUsername("clouditor"); assertEquals(user, user); assertNotEquals(user, null); assertNotEquals(user, new User()); assertNotEquals(user, new Object()); }