@Test
public void testProcessAWSAssumeRoleAssertion() {

    DataCache cache = new DataCache();
    assertNull(cache.getAWSResourceRoleSet("role"));
    Assertion assertion = new Assertion();
    assertion.setAction("assume_aws_role");
    assertion.setResource("resource");
    assertion.setRole("role");
    cache.processAWSAssumeRoleAssertion(assertion);
    Set<String> set = cache.getAWSResourceRoleSet("role");
    assertEquals(1, set.size());
    // calling with same assertion - no changes
    cache.processAWSAssumeRoleAssertion(assertion);
    set = cache.getAWSResourceRoleSet("role");
    assertEquals(1, set.size());
    // calling an assertion with deny should be no changes
    Assertion assertion2 = new Assertion();
    assertion2.setAction("assume_aws_role");
    assertion2.setResource("resource2");
    assertion2.setRole("role");
    assertion2.setEffect(AssertionEffect.DENY);
    cache.processAWSAssumeRoleAssertion(assertion2);
    set = cache.getAWSResourceRoleSet("role");
    assertEquals(1, set.size());
    // now another assertion with explicitly
    // specifying the effect
    Assertion assertion3 = new Assertion();
    assertion3.setAction("assume_aws_role");
    assertion3.setResource("resource3");
    assertion3.setRole("role");
    assertion3.setEffect(AssertionEffect.ALLOW);
    cache.processAWSAssumeRoleAssertion(assertion3);
    set = cache.getAWSResourceRoleSet("role");
    assertEquals(2, set.size());
    assertTrue(set.contains("resource"));
    assertTrue(set.contains("resource3"));
}