AbstractRestrictionProvider implements RestrictionProvider, AccessControlConstants { @NotNull protected Tree getRestrictionsTree(@NotNull Tree aceTree) { Tree restrictions = aceTree.getChild(REP_RESTRICTIONS); if (!restrictions.exists()) { restrictions = aceTree; } return restrictions; } AbstractRestrictionProvider(@NotNull Map<String, ? extends RestrictionDefinition> definitions); @NotNull @Override Set<RestrictionDefinition> getSupportedRestrictions(String oakPath); @NotNull @Override Restriction createRestriction(String oakPath, @NotNull String oakName, @NotNull Value value); @NotNull @Override Restriction createRestriction(String oakPath, @NotNull String oakName, @NotNull Value... values); @NotNull @Override Set<Restriction> readRestrictions(String oakPath, @NotNull Tree aceTree); @Override void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions); @Override void validateRestrictions(String oakPath, @NotNull Tree aceTree);  }
@Test public void testGetRestrictionTree() { Tree aceTree = getAceTree(); Tree restrictionTree = restrictionProvider.getRestrictionsTree(aceTree); assertEquals(aceTree.getChild(REP_RESTRICTIONS), restrictionTree); }
@Test public void testGetRestrictionTreeMissing() { Tree aceTree = when(mock(Tree.class).getChild(REP_RESTRICTIONS)).thenReturn(mock(Tree.class)).getMock(); Tree restrictionTree = restrictionProvider.getRestrictionsTree(aceTree); assertEquals(aceTree, restrictionTree); }