@Test public void testGetGrantedAuthorities() { final List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(1); authorities.add(authMock); context.checking(new Expectations() { { oneOf(authorityProviderMock).loadAuthoritiesByUsername("username"); will(returnValue(authorities)); } }); GrantedAuthority[] results = sut.getGrantedAuthorities(null, "username"); assertTrue("incorrect number of authorities returned.", 1 == results.length); context.assertIsSatisfied(); }
public GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(username); return authorities.toArray(new GrantedAuthority[authorities.size()]); }
LdapAuthoritiesPopulatorImpl implements LdapAuthoritiesPopulator { public GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(username); return authorities.toArray(new GrantedAuthority[authorities.size()]); } }
LdapAuthoritiesPopulatorImpl implements LdapAuthoritiesPopulator { public GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(username); return authorities.toArray(new GrantedAuthority[authorities.size()]); } LdapAuthoritiesPopulatorImpl(final AuthorityProvider inAuthorityProvider); }
LdapAuthoritiesPopulatorImpl implements LdapAuthoritiesPopulator { public GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(username); return authorities.toArray(new GrantedAuthority[authorities.size()]); } LdapAuthoritiesPopulatorImpl(final AuthorityProvider inAuthorityProvider); GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username); }
LdapAuthoritiesPopulatorImpl implements LdapAuthoritiesPopulator { public GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(username); return authorities.toArray(new GrantedAuthority[authorities.size()]); } LdapAuthoritiesPopulatorImpl(final AuthorityProvider inAuthorityProvider); GrantedAuthority[] getGrantedAuthorities(final DirContextOperations userData, final String username);  }