UserPrincipalProvider implements PrincipalProvider { @NotNull @Override public Set<? extends Principal> getPrincipals(@NotNull String userID) { Set<Principal> principals = new HashSet<>(); Tree tree = userProvider.getAuthorizable(userID); if (UserUtil.isType(tree, AuthorizableType.USER)) { Principal userPrincipal = createUserPrincipal(userID, tree); if (userPrincipal != null) { principals.add(userPrincipal); principals.addAll(getGroupMembership(tree)); } } return principals; } UserPrincipalProvider(@NotNull Root root,
                          @NotNull UserConfiguration userConfiguration,
                          @NotNull NamePathMapper namePathMapper); @Override Principal getPrincipal(@NotNull String principalName); @Nullable @Override ItemBasedPrincipal getItemBasedPrincipal(@NotNull String principalOakPath); @NotNull @Override Set<Principal> getMembershipPrincipals(@NotNull Principal principal); @NotNull @Override Set<? extends Principal> getPrincipals(@NotNull String userID); @NotNull @Override Iterator<? extends Principal> findPrincipals(@Nullable final String nameHint, final int searchType); @NotNull @Override Iterator<? extends Principal> findPrincipals(@Nullable final String nameHint, final boolean fullText, final int searchType, long offset,
            long limit); @NotNull @Override Iterator<? extends Principal> findPrincipals(int searchType);  }
@Test public void testMissingUserPrincipalName() throws Exception { User u = getTestUser(); Tree t = root.getTree(u.getPath()); t.removeProperty(REP_PRINCIPAL_NAME); assertTrue(principalProvider.getPrincipals(u.getID()).isEmpty()); }