// Set the decision manager to authorize
accessDecisionManager.setDecisionValue( true );
// Now install a token, a should be updated
controller.setAuthenticationToken( new TestingAuthenticationToken( "USER2", "FOO") );
assertTrue( "Object should be authorized", a1.isAuthorized() );
assertEquals( "Object should be updated", a1.getAuthCount(), 1 );
assertTrue( "Object should be authorized", a2.isAuthorized() );
assertEquals( "Object should be updated", a2.getAuthCount(), 1 );
controller.setAuthenticationToken( null );
assertFalse( "Object should not be authorized", a1.isAuthorized() );
assertEquals( "Object should be updated", a1.getAuthCount(), 2 );
assertFalse( "Object should not be authorized", a2.isAuthorized() );
assertEquals( "Object should be updated", a2.getAuthCount(), 2 );
// Set the decision manager to NOT authorize
accessDecisionManager.setDecisionValue( false );
// Now install a token, a should be updated
controller.setAuthenticationToken( new TestingAuthenticationToken( "USER2", "FOO") );
assertFalse( "Object should not be authorized", a1.isAuthorized() );
assertEquals( "Object should be updated", a1.getAuthCount(), 3 );
assertFalse( "Object should not be authorized", a2.isAuthorized() );
assertEquals( "Object should be updated", a2.getAuthCount(), 3 );
}