AuthCache { protected static Collection<Authorizations> getAuthorizations(String entityName) { if (!StringUtils.isEmpty(entityName)) { List<Authorizations> authorizationsList = new ArrayList<>(); TimelyPrincipal principal = AuthCache.get(entityName); if (principal != null) { for (Collection<String> authCollection : principal.getAuthorizations()) { authorizationsList.add(AuthorizationsUtil.toAuthorizations(authCollection)); } LOG.debug("Authorizations for user {} {}", entityName, principal.getAuthorizationsString()); return authorizationsList; } else { return Collections.singletonList(Authorizations.EMPTY); } } else { throw new IllegalArgumentException("entityName can not be null"); } }  static void resetConfiguration(); static void configure(Security security); static boolean containsKey(String key); static TimelyPrincipal get(String key); static void put(String key, TimelyPrincipal principal); static void remove(String key); static void clear(); static Collection<Authorizations> getAuthorizations(AuthenticatedRequest request, Security security);  }
@Test(expected = IllegalArgumentException.class) public void testSessionIdNull() throws Exception { AuthCache.getAuthorizations(""); }
@Test public void testGetAuths() throws Exception { Collection<Authorizations> auths = AuthCache.getAuthorizations(cookie); Assert.assertEquals(1, auths.size()); Authorizations a = auths.iterator().next(); Assert.assertEquals("A,B,C", a.toString()); }