CompositeRestrictionProvider implements RestrictionProvider { @NotNull @Override public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) { Set<RestrictionDefinition> defs = Sets.newHashSet(); for (RestrictionProvider rp : providers) { defs.addAll(rp.getSupportedRestrictions(oakPath)); } return defs; } private  CompositeRestrictionProvider(@NotNull Collection<? extends RestrictionProvider> providers); static RestrictionProvider newInstance(@NotNull RestrictionProvider... providers); static RestrictionProvider newInstance(@NotNull Collection<? extends RestrictionProvider> providers); @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(@Nullable 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 testGetSupportedRestrictions() { String[] paths = new String[] {null, "/testPath"}; for (String path : paths) { Set<RestrictionDefinition> defs = provider.getSupportedRestrictions(path); int expectedSize = rp1.getSupportedRestrictions(path).size() + rp2.getSupportedRestrictions(path).size(); assertEquals(expectedSize, defs.size()); assertTrue(defs.containsAll(rp1.getSupportedRestrictions(path))); assertTrue(defs.containsAll(rp2.getSupportedRestrictions(path))); } }