CompositeRestrictionProvider implements RestrictionProvider { @NotNull @Override public Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree) { Set<Restriction> restrictions = Sets.newHashSet(); for (RestrictionProvider rp : providers) { restrictions.addAll(rp.readRestrictions(oakPath, aceTree)); } return restrictions; } 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 testReadRestrictions() { Tree aceTree = getAceTree(NT_PREFIXES_RESTRICTION, MANDATORY_BOOLEAN_RESTRICTION, UNKNOWN_RESTRICTION); Set<Restriction> restrictions = provider.readRestrictions("/test", aceTree); assertEquals(2, restrictions.size()); for (Restriction r : restrictions) { String name = r.getDefinition().getName(); if (!supported.contains(name)) { fail("read unsupported restriction"); } } }