@Test
public void testGetCachedCreds() {

    CloudStore cloudStore = new CloudStore();
    AWSTemporaryCredentials creds = new AWSTemporaryCredentials();
    creds.setAccessKeyId("keyid");
    creds.setSecretAccessKey("accesskey");
    creds.setSessionToken("token");
    // set the expiration for 1 hour from now
    creds.setExpiration(Timestamp.fromMillis(System.currentTimeMillis() + 3600*1000));
    cloudStore.putCacheCreds("account:role:user::", creds);
    // fetching with a different cache key should not match anything
    assertNull(cloudStore.getCachedCreds("account:role:user:100:", null));
    assertNull(cloudStore.getCachedCreds("account:role:user::ext", null));
    // fetching with null duration should match (default to 3600) and return our object
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", null));
    // fetching with 0 duration should match (default to 3600) and return our object
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", 0));
    // fetching with negative duration should match (default to 3600) and return our object
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", -1));
    // fetching with 1 hour duration should match and return our object
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", 3600));
    // fetching with 45 min duration should match duration
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", 2700));
    // fetching with 1 hour and 5 min duration should match and return our object
    assertNotNull(cloudStore.getCachedCreds("account:role:user::", 3900));
    // fetching with 1 hour and 11 min duration should not match
    assertNull(cloudStore.getCachedCreds("account:role:user::", 4260));
    // fetching with 2 hour duration should not match
    assertNull(cloudStore.getCachedCreds("account:role:user::", 7200));
    cloudStore.close();
}