ContextUtil { public static String getCurrentUserLoginId() { RangerSecurityContext context = RangerContextHolder.getSecurityContext(); if (context != null) { UserSessionBase userSession = context.getUserSession(); if (userSession != null) { return userSession.getLoginId(); } } return null; } ContextUtil(); static Long getCurrentUserId(); static String getCurrentUserPublicName(); static UserSessionBase getCurrentUserSession(); static RequestContext getCurrentRequestContext(); static String getCurrentUserLoginId(); static boolean isBulkModeContext();  }
@SuppressWarnings("static-access") @Test public void testCurrentUserLoginId(){ String expectedLoginId = "rangerAdmin"; gjUser.setLoginId("rangerAdmin"); String loginId = contextUtil.getCurrentUserLoginId(); Assert.assertEquals(expectedLoginId, loginId); }