AbstractEntry extends ACE implements PrincipalAccessControlList.Entry { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof AbstractEntry) { AbstractEntry other = (AbstractEntry) obj; return equivalentPath(other.oakPath) && super.equals(obj); } return false; } AbstractEntry(@Nullable String oakPath, @NotNull Principal principal, @NotNull PrivilegeBits privilegeBits, @NotNull Set<Restriction> restrictions, @NotNull NamePathMapper namePathMapper); @Override @Nullable String getEffectivePath(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() throws Exception { assertNotEquals(entryA, entryB); assertNotEquals(entryB, entryA); assertEquals(entryA, entryA); assertEquals(entryA, new TestEntry(entryA)); assertEquals(entryB, new TestEntry(entryB)); AbstractEntry differentRestriction = new TestEntry(entryA.getOakPath(), entryA.getPrincipal(), entryA.getPrivilegeBits(), restriction); assertNotEquals(entryA, differentRestriction); AbstractEntry differentPath = new TestEntry(PathUtils.ROOT_PATH, entryA.getPrincipal(), entryA.getPrivilegeBits(), entryA.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryA, differentPath); AbstractEntry differentPrincipal = new TestEntry(entryB.getOakPath(), EveryonePrincipal.getInstance(), entryB.getPrivilegeBits(), entryB.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryB, differentPath); AbstractEntry differentPrivs = new TestEntry(entryB.getOakPath(), entryB.getPrincipal(), bitsProvider.getBits(PrivilegeConstants.JCR_READ), entryB.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryB, differentPrivs); }