@Test(expected = IllegalArgumentException.class)
 public void testAfterPropertiesSetEmptyMap() throws Exception {
   MapBasedAttributes2GrantedAuthoritiesMapper mapper =
       new MapBasedAttributes2GrantedAuthoritiesMapper();
   mapper.setAttributes2grantedAuthoritiesMap(new HashMap());
   mapper.afterPropertiesSet();
 }
 private MapBasedAttributes2GrantedAuthoritiesMapper getDefaultMapper() throws Exception {
   MapBasedAttributes2GrantedAuthoritiesMapper mapper =
       new MapBasedAttributes2GrantedAuthoritiesMapper();
   mapper.setAttributes2grantedAuthoritiesMap(getValidAttributes2GrantedAuthoritiesMap());
   mapper.afterPropertiesSet();
   return mapper;
 }
 @Test
 public void testAfterPropertiesSetValidMap() throws Exception {
   MapBasedAttributes2GrantedAuthoritiesMapper mapper =
       new MapBasedAttributes2GrantedAuthoritiesMapper();
   HashMap m = getValidAttributes2GrantedAuthoritiesMap();
   mapper.setAttributes2grantedAuthoritiesMap(m);
   mapper.afterPropertiesSet();
 }
 @Test(expected = IllegalArgumentException.class)
 public void testAfterPropertiesSetInvalidValueTypeMap2() throws Exception {
   MapBasedAttributes2GrantedAuthoritiesMapper mapper =
       new MapBasedAttributes2GrantedAuthoritiesMapper();
   HashMap m = new HashMap();
   m.put("role1", new Object[] {new String[] {"ga1", "ga2"}, new Object()});
   mapper.setAttributes2grantedAuthoritiesMap(m);
   mapper.afterPropertiesSet();
 }
 @Test(expected = IllegalArgumentException.class)
 public void testAfterPropertiesSetInvalidKeyTypeMap() throws Exception {
   MapBasedAttributes2GrantedAuthoritiesMapper mapper =
       new MapBasedAttributes2GrantedAuthoritiesMapper();
   HashMap m = new HashMap();
   m.put(new Object(), "ga1");
   mapper.setAttributes2grantedAuthoritiesMap(m);
   mapper.afterPropertiesSet();
 }
 private void testGetGrantedAuthorities(
     MapBasedAttributes2GrantedAuthoritiesMapper mapper, String[] roles, String[] expectedGas) {
   List<GrantedAuthority> result = mapper.getGrantedAuthorities(Arrays.asList(roles));
   Collection resultColl = new ArrayList(result.size());
   for (GrantedAuthority auth : result) {
     resultColl.add(auth.getAuthority());
   }
   Collection expectedColl = Arrays.asList(expectedGas);
   assertTrue(
       "Role collections should match; result: " + resultColl + ", expected: " + expectedColl,
       expectedColl.containsAll(resultColl) && resultColl.containsAll(expectedColl));
 }