@Test public void testGetUser() { List<GrantedAuthority> auths = new ArrayList<>(); auths.add(new SimpleGrantedAuthority("ROLE1")); auths.add(new SimpleGrantedAuthority("ROLE2")); UserDetails userDetails = new User("admin", "password", auths); SessionUser sessionUser = new SessionUser(userDetails); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( sessionUser, null, auths); SecurityContextHolder.getContext().setAuthentication(authentication); SecurityUtil securityUtil = new SecurityUtil(); SessionUser actual = securityUtil.getUser(); assertNotNull(actual); assertEquals("admin", actual.getUsername()); }
public SessionUser getUser() { return SecurityUtil.getSessionUser(); }
SecurityUtil { public SessionUser getUser() { return SecurityUtil.getSessionUser(); } }
SecurityUtil { public SessionUser getUser() { return SecurityUtil.getSessionUser(); }  }
SecurityUtil { public SessionUser getUser() { return SecurityUtil.getSessionUser(); }  static SessionUser getSessionUser(); SessionUser getUser(); static boolean currentUserHasPermission(final String permission); static Integer userTimeZone(); static Date userNow(); Date getNow(); }
SecurityUtil { public SessionUser getUser() { return SecurityUtil.getSessionUser(); }  static SessionUser getSessionUser(); SessionUser getUser(); static boolean currentUserHasPermission(final String permission); static Integer userTimeZone(); static Date userNow(); Date getNow();  }