public final void testGetGrantedAuthoritiesToLowerCase() { String[] roles = {"Role1", "Role2"}; String[] expectedGas = {"role1", "role2"}; SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper(); mapper.setConvertAttributeToLowerCase(true); testGetGrantedAuthorities(mapper, roles, expectedGas); }
private SimpleAttributes2GrantedAuthoritiesMapper getDefaultMapper() { SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper(); mapper.setAttributePrefix(""); mapper.setConvertAttributeToLowerCase(false); mapper.setConvertAttributeToUpperCase(false); mapper.setAddPrefixIfAlreadyExisting(false); return mapper; }
public final void testAfterPropertiesSetConvertToUpperAndLowerCase() { SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper(); mapper.setConvertAttributeToLowerCase(true); mapper.setConvertAttributeToUpperCase(true); try { mapper.afterPropertiesSet(); fail("Expected exception not thrown"); } catch (IllegalArgumentException expected) { } catch (Exception unexpected) { fail("Unexpected exception: " + unexpected); } }