PrincipalPolicyImpl extends AbstractAccessControlList implements PrincipalAccessControlList { @Override public void removeAccessControlEntry(AccessControlEntry ace) throws RepositoryException { validateEntry(ace); if (!entries.remove(ace)) { throw new AccessControlException("AccessControlEntry " +ace+ " not contained in AccessControlList"); } } PrincipalPolicyImpl(@NotNull Principal principal, @NotNull String oakPath, @NotNull MgrProvider mgrProvider); @Override @NotNull List<EntryImpl> getEntries(); @Override @NotNull RestrictionProvider getRestrictionProvider(); @Override @NotNull Principal getPrincipal(); @Override boolean addEntry(@Nullable String effectivePath, @NotNull Privilege[] privileges); @Override boolean addEntry(@Nullable String effectivePath, @NotNull Privilege[] privileges, @NotNull Map<String, Value> restrictions, @NotNull Map<String, Value[]> mvRestrictions); @Override boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges, boolean isAllow, @Nullable Map<String, Value> restrictions, @Nullable Map<String, Value[]> mvRestrictions); @Override void orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry); @Override void removeAccessControlEntry(AccessControlEntry ace);  }
@Test public void testRemoveEntry() throws Exception { for (AccessControlEntry entry : policy.getAccessControlEntries()) { assertFalse(policy.isEmpty()); policy.removeAccessControlEntry(entry); }; assertTrue(policy.isEmpty()); }
@Test(expected = AccessControlException.class) public void testRemoveEntryTwice() throws Exception { AccessControlEntry entry = policy.getAccessControlEntries()[0]; policy.removeAccessControlEntry(entry); policy.removeAccessControlEntry(entry); }