ContextUtil { public static UserSessionBase getCurrentUserSession() { UserSessionBase userSession = null; RangerSecurityContext context = RangerContextHolder.getSecurityContext(); if (context != null) { userSession = context.getUserSession(); } return userSession; } 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 testCurrentUserSession(){ UserSessionBase expectedUserSession = contextUtil.getCurrentUserSession(); Assert.assertNotNull(expectedUserSession); }
@SuppressWarnings("static-access") @Test public void testCurrentUserSessionAsNull(){ context.setUserSession(null); UserSessionBase expectedUserSession = contextUtil.getCurrentUserSession(); Assert.assertNull(expectedUserSession); }