ContextUtil { public static Long getCurrentUserId() { RangerSecurityContext context = RangerContextHolder.getSecurityContext(); if (context != null) { UserSessionBase userSession = context.getUserSession(); if (userSession != null) { return userSession.getUserId(); } } 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 testGetCurrentUserId(){ Long expectedId = 1L; Long id = contextUtil.getCurrentUserId(); Assert.assertEquals(expectedId, id); }