@Test public void testGrantNoAuthorities() { final List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); context.checking(new Expectations() { { oneOf(principalMock).getName(); oneOf(authorityProviderMock).loadAuthoritiesByUsername(with(any(String.class))); will(returnValue(authorities)); } }); assertNull(sut.grant(principalMock)); context.assertIsSatisfied(); }
@SuppressWarnings("unchecked") public Set grant(final Principal inPrincipal) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(inPrincipal.getName()); return authorities.size() == 0 ? null : new HashSet(authorities); }
JaasAuthorityGranter implements AuthorityGranter { @SuppressWarnings("unchecked") public Set grant(final Principal inPrincipal) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(inPrincipal.getName()); return authorities.size() == 0 ? null : new HashSet(authorities); } }
JaasAuthorityGranter implements AuthorityGranter { @SuppressWarnings("unchecked") public Set grant(final Principal inPrincipal) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(inPrincipal.getName()); return authorities.size() == 0 ? null : new HashSet(authorities); } JaasAuthorityGranter(final AuthorityProvider inAuthorityProvider); }
JaasAuthorityGranter implements AuthorityGranter { @SuppressWarnings("unchecked") public Set grant(final Principal inPrincipal) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(inPrincipal.getName()); return authorities.size() == 0 ? null : new HashSet(authorities); } JaasAuthorityGranter(final AuthorityProvider inAuthorityProvider); @SuppressWarnings("unchecked") Set grant(final Principal inPrincipal); }
JaasAuthorityGranter implements AuthorityGranter { @SuppressWarnings("unchecked") public Set grant(final Principal inPrincipal) { List<GrantedAuthority> authorities = authorityProvider.loadAuthoritiesByUsername(inPrincipal.getName()); return authorities.size() == 0 ? null : new HashSet(authorities); } JaasAuthorityGranter(final AuthorityProvider inAuthorityProvider); @SuppressWarnings("unchecked") Set grant(final Principal inPrincipal);  }