@Test
public void testGetAWSTemporaryCredentials() {

    Timestamp currentTime = Timestamp.fromCurrentTime();
    ZTSRDLClientMock ztsClientMock = new ZTSRDLClientMock();
    ztsClientMock.setAwsCreds(currentTime, "coretech", "role", "sessionToken",
            "secretAccessKey", "accessKeyId");
    Principal principal = SimplePrincipal.create("user_domain", "user",
            "v=S1;d=user_domain;n=user;s=sig", PRINCIPAL_AUTHORITY);
    ZTSClient client = new ZTSClient("http://localhost:4080", principal);
    client.setZTSRDLGeneratedClient(ztsClientMock);
    AWSTemporaryCredentials awsCreds = client.getAWSTemporaryCredentials("coretech", "role");
    assertNotNull(awsCreds);
    assertEquals("accessKeyId", awsCreds.getAccessKeyId());
    assertEquals("secretAccessKey", awsCreds.getSecretAccessKey());
    assertTrue(awsCreds.getSessionToken().startsWith("sessionToken"));
    currentTime = awsCreds.getExpiration();
    AWSTemporaryCredentials awsCreds2 = client.getAWSTemporaryCredentials("coretech", "role");
    assertNotNull(awsCreds2);
    assertEquals("accessKeyId", awsCreds2.getAccessKeyId());
    assertEquals("secretAccessKey", awsCreds2.getSecretAccessKey());
    assertTrue(awsCreds2.getSessionToken().startsWith("sessionToken"));
    assertEquals(currentTime.millis() / 1000, awsCreds2.getExpiration().millis() / 1000);
    // now let's try with invalid domain/role values;
    assertNull(client.getAWSTemporaryCredentials("coretech", "role1"));
    assertNull(client.getAWSTemporaryCredentials("coretech1", "role"));
    client.close();
}