@Test
public void testGetTokenException() {

    System.setProperty(ZTSConsts.ZTS_PROP_AWS_RDS_MASTER_INSTANCE, "instance");
    System.setProperty(ZTSConsts.ZTS_PROP_AWS_RDS_USER, "rds-user");
    System.setProperty(ZTSConsts.ZTS_PROP_AWS_RDS_IAM_ROLE, "role");
    System.setProperty(ZTSConsts.ZTS_PROP_AWS_RDS_CREDS_REFRESH_TIME, "1");
    AWSCertRecordStoreFactory factory = new TestAWSCertRecordStoreFactory2();
    CertRecordStore store = factory.create(null);
    assertNotNull(store);
    ((TestAWSCertRecordStoreFactory2) factory).setThrowGetTokenExc(true);
    // we should not get any exceptions even though the get token
    // call will throw exceptions
    AWSCertRecordStoreFactory.CredentialsUpdater updater = factory.new CredentialsUpdater();
    updater.run();
    updater.run();
    System.clearProperty(ZTSConsts.ZTS_PROP_AWS_RDS_MASTER_INSTANCE);
    System.clearProperty(ZTSConsts.ZTS_PROP_AWS_RDS_USER);
    System.clearProperty(ZTSConsts.ZTS_PROP_AWS_RDS_IAM_ROLE);
    System.clearProperty(ZTSConsts.ZTS_PROP_AWS_RDS_CREDS_REFRESH_TIME);
}