AuthCache { public static Authorizations getAuthorizations(String sessionId) { if (!StringUtils.isEmpty(sessionId)) { Authentication auth = CACHE.asMap().get(sessionId); if (null != auth) { Collection<? extends GrantedAuthority> authorities = CACHE.asMap().get(sessionId).getAuthorities(); String[] auths = new String[authorities.size()]; final AtomicInteger i = new AtomicInteger(0); authorities.forEach(a -> auths[i.getAndIncrement()] = a.getAuthority()); return new Authorizations(auths); } else { return null; } } else { throw new IllegalArgumentException("session id cannot be null"); } }  static void resetSessionMaxAge(); static void setSessionMaxAge(Configuration config); static Cache<String, Authentication> getCache(); static Authorizations getAuthorizations(String sessionId); static void enforceAccess(Configuration conf, String sessionId);  }
@Test(expected = IllegalArgumentException.class) public void testSessionIdNull() throws Exception { AuthCache.getAuthorizations(""); }
@Test public void testGetAuths() throws Exception { Authorizations a = AuthCache.getAuthorizations(cookie); Assert.assertEquals("A,B,C", a.toString()); }