ValidationEntry { @Override public int hashCode() { return Objects.hashCode(principalName, privilegeBits, restrictions, isAllow); } ValidationEntry(@NotNull String principalName, @NotNull PrivilegeBits privilegeBits, boolean isAllow, @NotNull Set<Restriction> restrictions);  ValidationEntry(@NotNull String principalName, @NotNull PrivilegeBits privilegeBits, boolean isAllow, @NotNull Set<Restriction> restrictions, int index); @Override int hashCode(); @Override boolean equals(Object o);  }
@Test public void testHashcode() { int hc = entry.hashCode(); assertEquals(hc, entry.hashCode()); assertEquals(hc, new ValidationEntry(entry.principalName, entry.privilegeBits, entry.isAllow, entry.restrictions).hashCode()); assertEquals(hc, new ValidationEntry(entry.principalName, entry.privilegeBits, entry.isAllow, entry.restrictions, entry.index+1).hashCode()); assertNotEquals(hc, new ValidationEntry("other", entry.privilegeBits, entry.isAllow, entry.restrictions).hashCode()); assertNotEquals(hc, new ValidationEntry(entry.principalName, PrivilegeBits.BUILT_IN.get(REP_WRITE), entry.isAllow, entry.restrictions).hashCode()); assertNotEquals(hc, new ValidationEntry(entry.principalName, entry.privilegeBits, !entry.isAllow, entry.restrictions).hashCode()); assertNotEquals(hc, new ValidationEntry(entry.principalName, entry.privilegeBits, entry.isAllow, ImmutableSet.of()).hashCode()); }