CompositePrincipalProvider implements PrincipalProvider { @Nullable @Override public Principal getPrincipal(@NotNull String principalName) { Principal principal = null; for (int i = 0; i < providers.size() && principal == null; i++) { principal = providers.get(i).getPrincipal(principalName); } return principal; } CompositePrincipalProvider(List<PrincipalProvider> providers); static PrincipalProvider of(@NotNull List<PrincipalProvider> providers); @Nullable @Override Principal getPrincipal(@NotNull String principalName); @Nullable @Override ItemBasedPrincipal getItemBasedPrincipal(@NotNull String principalOakPath); @NotNull @Override Set<Principal> getMembershipPrincipals(@NotNull Principal principal); @NotNull @Override Set<Principal> getPrincipals(@NotNull String userID); @NotNull @Override Iterator<Principal> findPrincipals(@Nullable String nameHint, int searchType); @NotNull @Override Iterator<? extends Principal> findPrincipals(int searchType); @NotNull @Override Iterator<? extends Principal> findPrincipals(@Nullable String nameHint, boolean fullText, int searchType,
            long offset, long limit);  }
@Test public void getPrincipalUnknown() { assertNull(cpp.getPrincipal(TestPrincipalProvider.UNKNOWN.getName())); }
@Test public void getPrincipal() { for (Principal principal : testPrincipals()) { assertEquals(principal, cpp.getPrincipal(principal.getName())); } }