PrincipalRestrictionProvider implements RestrictionProvider, AccessControlConstants { @NotNull @Override public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) { Set<RestrictionDefinition> definitions = new HashSet<>(base.getSupportedRestrictions(oakPath)); definitions.add(new RestrictionDefinitionImpl(REP_NODE_PATH, Type.PATH, true)); return definitions; } PrincipalRestrictionProvider(RestrictionProvider base); @NotNull @Override Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value value); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values); @NotNull @Override Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree); @Override void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions); @Override void validateRestrictions(String oakPath, @NotNull Tree aceTree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Set<Restriction> restrictions);  }
@Test public void testGetSupportedDefinitions() { when(base.getSupportedRestrictions(anyString())).thenReturn(Collections.emptySet()); Set<RestrictionDefinition> defs = provider.getSupportedRestrictions("/testPath"); assertNotNull(defs); assertEquals(1, defs.size()); assertEquals(REP_NODE_PATH, defs.iterator().next().getName()); }