UserUtil implements UserConstants { public static boolean isSystemUser(@Nullable Tree authorizableTree) { return authorizableTree != null && NT_REP_SYSTEM_USER.equals(TreeUtil.getPrimaryTypeName(authorizableTree)); } private  UserUtil(); static boolean isAdmin(@NotNull ConfigurationParameters parameters, @NotNull String userId); @NotNull static String getAdminId(@NotNull ConfigurationParameters parameters); @NotNull static String getAnonymousId(@NotNull ConfigurationParameters parameters); static boolean isType(@Nullable Tree authorizableTree, @NotNull AuthorizableType type); @Nullable static AuthorizableType getType(@NotNull Tree authorizableNode); @Nullable static AuthorizableType getType(@Nullable String primaryTypeName); static boolean isSystemUser(@Nullable Tree authorizableTree); @Nullable static String getAuthorizableRootPath(@NotNull ConfigurationParameters parameters,
                                                 @Nullable AuthorizableType type); @Nullable static String getAuthorizableId(@NotNull Tree authorizableTree); @NotNull static String getAuthorizableId(@NotNull Tree authorizableTree, @NotNull AuthorizableType type); @Nullable static T castAuthorizable(@Nullable Authorizable authorizable, Class<T> authorizableClass); static int getImportBehavior(@NotNull ConfigurationParameters config);  }
@Test public void testIsSystemUserNullTree() { assertFalse(UserUtil.isSystemUser(null)); }
@Test public void testIsSystemUser() { Map<String, Boolean> test = ImmutableMap.of( UserConstants.NT_REP_GROUP, false, UserConstants.NT_REP_USER, false, UserConstants.NT_REP_SYSTEM_USER, true, UserConstants.NT_REP_AUTHORIZABLE, false, JcrConstants.NT_FILE, false ); for (String ntName : test.keySet()) { boolean expected = test.get(ntName); assertEquals(ntName, expected, UserUtil.isSystemUser(createTree(ntName))); } }