@Test
public void testRemoveExpiredCredentials() {

    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);
    assertFalse(cloudStore.removeExpiredCredentials());
    // now let's add an expired entry
    AWSTemporaryCredentials creds2 = new AWSTemporaryCredentials();
    creds2.setAccessKeyId("keyid");
    creds2.setSecretAccessKey("accesskey");
    creds2.setSessionToken("token");
    // expired credential
    creds2.setExpiration(Timestamp.fromMillis(System.currentTimeMillis() - 1000));
    cloudStore.putCacheCreds("account:role:user2::", creds2);
    assertTrue(cloudStore.removeExpiredCredentials());
    cloudStore.close();
}