### Question:
AclAwareDecisionVoter implements AccessDecisionVoter { @Override public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) { int baseVoterVoteResult = baseVoter.vote(authentication, object, attributes); if (baseVoterVoteResult == ACCESS_GRANTED && authenticatedAsUser(authentication)) { return authorizeAndSaveDecisionIntoSession(authentication); } else { return baseVoterVoteResult; } } AclAwareDecisionVoter(UserService userService); @VisibleForTesting  AclAwareDecisionVoter(AccessDecisionVoter baseVoter, UserService userService); @Override int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes); @Override boolean supports(ConfigAttribute attribute); @Override boolean supports(Class<?> clazz);  }### Answer:
@Test public void notAuthorized() { Authentication authentication = mock(Authentication.class); authenticatedSuccessfully(authentication); when(authentication.getPrincipal()).thenReturn("anonymous"); assertEquals(voter.vote(authentication, new Object(), ATTRIBUTES), ACCESS_GRANTED); }