### Question:
AuthorizationHelper { public static String getAuthenticatedName() { return getAuthenticatedName(null); }  static String getProxyUserName(Authentication authentication); static String getProxyUserName(); Collection<GrantedAuthority> convertPrivilegesToAuthorities(Collection<PrivilegeEntity> privilegeEntities); static String getAuthenticatedName(); static String getAuthenticatedName(String defaultUsername); static int getAuthenticatedId(); static boolean isAuthorized(ResourceType resourceType, Long resourceId,
                                     RoleAuthorization requiredAuthorization); static boolean isAuthorized(ResourceType resourceType, Long resourceId,
                                     Set<RoleAuthorization> requiredAuthorizations); static boolean isAuthorized(Authentication authentication, ResourceType resourceType,
                                     Long resourceId, RoleAuthorization requiredAuthorization); static boolean isAuthorized(Authentication authentication, ResourceType resourceType,
                                     Long resourceId, Set<RoleAuthorization> requiredAuthorizations); static void verifyAuthorization(ResourceType resourceType,
                                         Long resourceId,
                                         Set<RoleAuthorization> requiredAuthorizations); static void verifyAuthorization(Authentication authentication,
                                         ResourceType resourceType,
                                         Long resourceId,
                                         Set<RoleAuthorization> requiredAuthorizations); static Authentication getAuthentication(); static void addLoginNameAlias(String ambariUserName, String loginAlias); static String resolveLoginAliasToUserName(String loginAlias); static List<String> getAuthorizationNames(Authentication authentication);  }### Answer:
@Test public void testAuthName() throws Exception { String user = AuthorizationHelper.getAuthenticatedName(); Assert.assertNull(user); Authentication auth = new UsernamePasswordAuthenticationToken("admin", null); SecurityContextHolder.getContext().setAuthentication(auth); user = AuthorizationHelper.getAuthenticatedName(); Assert.assertEquals("admin", user); }