@Test
public void testGetAWSTemporaryCredentials() {

    
    Principal principal = SimplePrincipal.create("user_domain", "user101",
            "v=U1;d=user_domain;n=user101;s=signature", 0, null);
    MockCloudStore cloudStore = new MockCloudStore();
    cloudStore.setMockFields("1234", "aws_role_name", "user_domain.user101");
    store.setCloudStore(cloudStore);
    zts.cloudStore = cloudStore;
    
    SignedDomain signedDomain = createAwsSignedDomain("athenz.product", "1234");
    store.processDomain(signedDomain, false);
    
    AWSTemporaryCredentials creds = zts.getAWSTemporaryCredentials(
            createResourceContext(principal), "athenz.product", "aws_role_name", null, null);
    assertNotNull(creds);
    
    // now try a failure case
    
    try {
        cloudStore.setMockFields("1234", "aws_role2_name", "user_domain.user101");
        zts.getAWSTemporaryCredentials(createResourceContext(principal), "athenz.product", "aws_role_name", null, null);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}