PrincipalRestrictionProvider implements RestrictionProvider, AccessControlConstants { @NotNull @Override public RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree) { return base.getPattern(oakPath, tree); } 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 testGetPatternFromTree() throws Exception { Tree t = mock(Tree.class); when(base.getPattern("/testPath", t)).thenReturn(RestrictionPattern.EMPTY); assertSame(RestrictionPattern.EMPTY, provider.getPattern("/testPath", t)); verify(base, times(1)).getPattern("/testPath", t); }
@Test public void testGetPatternFromRestrictions() throws Exception { Restriction r = mock(Restriction.class); Set<Restriction> restrictions = Collections.singleton(r); provider.getPattern("/testPath", restrictions); verify(base, times(1)).getPattern("/testPath", restrictions); }