PrincipalManagerImpl implements PrincipalQueryManager, PrincipalManager { @Override @NotNull public PrincipalIterator getPrincipals(int searchType) { return new PrincipalIteratorAdapter(principalProvider.findPrincipals(searchType)); } PrincipalManagerImpl(@NotNull PrincipalProvider principalProvider); @Override boolean hasPrincipal(@NotNull String principalName); @Override @Nullable Principal getPrincipal(@NotNull String principalName); @Override @NotNull PrincipalIterator findPrincipals(@Nullable String simpleFilter); @Override @NotNull PrincipalIterator findPrincipals(@Nullable String simpleFilter, int searchType); @Override @NotNull PrincipalIterator getPrincipals(int searchType); @Override @NotNull PrincipalIterator getGroupMembership(@NotNull Principal principal); @Override @NotNull Principal getEveryone(); @NotNull @Override PrincipalIterator findPrincipals(@Nullable String simpleFilter, boolean fullText, int searchType, long offset, long limit);  }
@Test public void testGetPrincipalsNonGroupContainsNoGroups() { PrincipalIterator it = principalMgr.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP); while (it.hasNext()) { Principal p = it.nextPrincipal(); assertFalse(isGroup(p)); } }
@Test public void testGetPrincipalsGroupContainsGroups() { PrincipalIterator it = principalMgr.getPrincipals(PrincipalManager.SEARCH_TYPE_GROUP); while (it.hasNext()) { Principal p = it.nextPrincipal(); assertTrue(isGroup(p)); } }