PermissionEntry implements Comparable<PermissionEntry>, PermissionConstants { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof PermissionEntry) { PermissionEntry that = (PermissionEntry) o; return index == that.index && isAllow == that.isAllow && privilegeBits.equals(that.privilegeBits) && path.equals(that.path) && restriction.equals(that.restriction); } return false; } PermissionEntry(@NotNull String path, boolean isAllow, int index,
                    @NotNull PrivilegeBits privilegeBits,
                    @NotNull RestrictionPattern restriction); @Override int compareTo(@NotNull PermissionEntry pe); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { assertTrue(entry.equals(entry)); assertTrue(entry.equals(new PermissionEntry(path, entry.isAllow, index, entry.privilegeBits, entry.restriction))); assertTrue(entry.equals(new PermissionEntry(path, entry.isAllow, index, PrivilegeBits.getInstance(entry.privilegeBits).unmodifiable(), entry.restriction))); }
@Test public void testNotEqual() { assertNotEquals(entry, new PermissionEntry("/", entry.isAllow, index, entry.privilegeBits, entry.restriction)); assertNotEquals(entry, new PermissionEntry("/path2", entry.isAllow, index, entry.privilegeBits, entry.restriction)); assertNotEquals(entry, new PermissionEntry(path, !entry.isAllow, index, entry.privilegeBits, entry.restriction)); assertNotEquals(entry, new PermissionEntry(path, entry.isAllow, 2, entry.privilegeBits, entry.restriction)); assertNotEquals(entry, new PermissionEntry(path, entry.isAllow, index, PrivilegeBits.BUILT_IN.get(PrivilegeConstants.JCR_READ), entry.restriction)); assertNotEquals(entry, new PermissionEntry(path, entry.isAllow, index, entry.privilegeBits, mock(RestrictionPattern.class))); assertFalse(entry.equals(null)); }