@Test public void testHashCode() { Authority userAuthority = new Authority("user"); Authority adminAuthority = new Authority("admin"); assertThat(userAuthority.hashCode(), not(equalTo(adminAuthority.hashCode()))); assertThat(userAuthority.hashCode(), equalTo(new Authority("user").hashCode())); }
@Override public int hashCode() { return authority.hashCode(); }
Authority implements GrantedAuthority { @Override public int hashCode() { return authority.hashCode(); } }
Authority implements GrantedAuthority { @Override public int hashCode() { return authority.hashCode(); } private  Authority();  Authority(String authority);  Authority(String authority, String description); }
Authority implements GrantedAuthority { @Override public int hashCode() { return authority.hashCode(); } private  Authority();  Authority(String authority);  Authority(String authority, String description); @Id @GeneratedValue Long getId(); void setId(Long id); @Override @Column(unique = true) String getAuthority(); String getDescription(); void setDescription(String description); Long getVersion(); void setVersion(Long version); LocalDateTime getLastModified(); void setLastModified(LocalDateTime lastModified); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
Authority implements GrantedAuthority { @Override public int hashCode() { return authority.hashCode(); } private  Authority();  Authority(String authority);  Authority(String authority, String description); @Id @GeneratedValue Long getId(); void setId(Long id); @Override @Column(unique = true) String getAuthority(); String getDescription(); void setDescription(String description); Long getVersion(); void setVersion(Long version); LocalDateTime getLastModified(); void setLastModified(LocalDateTime lastModified); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }