PrincipalManagerImpl implements PrincipalQueryManager, PrincipalManager { @Override @Nullable public Principal getPrincipal(@NotNull String principalName) { return principalProvider.getPrincipal(principalName); } 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 testGetPrincipalEveryone() { assertEquals(EveryonePrincipal.getInstance(), principalMgr.getPrincipal(EveryonePrincipal.NAME)); }
@Test public void testGetPrincipalUnknown() { assertNull(principalMgr.getPrincipal(TestPrincipalProvider.UNKNOWN.getName())); }
@Test public void testGetPrincipal() { for (Principal principal : testPrincipals){ Principal pp = principalMgr.getPrincipal(principal.getName()); assertNotNull(pp); assertEquals("PrincipalManager.getPrincipal returned Principal with different Name", principal.getName(), pp.getName()); assertEquals("PrincipalManager.getPrincipal returned different Principal", principal, pp); } }