EmptyPrincipalProvider implements PrincipalProvider { @NotNull @Override public Iterator<? extends Principal> findPrincipals(@Nullable String nameHint, int searchType) { return Collections.emptyIterator(); } private  EmptyPrincipalProvider(); @Override Principal getPrincipal(@NotNull String principalName); @NotNull @Override Set<Principal> getMembershipPrincipals(@NotNull Principal principal); @NotNull @Override Set<? extends Principal> getPrincipals(@NotNull String userID); @NotNull @Override Iterator<? extends Principal> findPrincipals(@Nullable String nameHint, int searchType); @NotNull @Override Iterator<? extends Principal> findPrincipals(int searchType); static final PrincipalProvider INSTANCE; }
@Test public void testFindPrincipalsByHint() { assertFalse(principalProvider.findPrincipals(EveryonePrincipal.NAME, PrincipalManager.SEARCH_TYPE_ALL).hasNext()); assertFalse(principalProvider.findPrincipals(EveryonePrincipal.NAME.substring(0, 1), PrincipalManager.SEARCH_TYPE_ALL).hasNext()); assertFalse(principalProvider.findPrincipals(testPrincipal.getName(), PrincipalManager.SEARCH_TYPE_ALL).hasNext()); assertFalse(principalProvider.findPrincipals(testPrincipal.getName().substring(0, 2), PrincipalManager.SEARCH_TYPE_ALL).hasNext()); }
@Test public void testFindPrincipalsByType() { assertFalse(principalProvider.findPrincipals(PrincipalManager.SEARCH_TYPE_ALL).hasNext()); assertFalse(principalProvider.findPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP).hasNext()); assertFalse(principalProvider.findPrincipals(PrincipalManager.SEARCH_TYPE_GROUP).hasNext()); }