@Test
public void testContainsCredential() throws Exception {

  PrincipalKeyCredential credential1 = new PrincipalKeyCredential("username1", "password1");
  PrincipalKeyCredential credential2 = new PrincipalKeyCredential("username2", "password2");
  PrincipalKeyCredential credential3 = new PrincipalKeyCredential("username3", "password3");
  PrincipalKeyCredential credential4 = new PrincipalKeyCredential("username4", "password4");
  credentialStoreService.setCredential(CLUSTER_NAME, "test1", credential1, CredentialStoreType.PERSISTED);
  credentialStoreService.setCredential(CLUSTER_NAME, "test2", credential2, CredentialStoreType.PERSISTED);
  credentialStoreService.setCredential(CLUSTER_NAME, "test3", credential3, CredentialStoreType.TEMPORARY);
  credentialStoreService.setCredential(CLUSTER_NAME, "test4", credential4, CredentialStoreType.TEMPORARY);
  Assert.assertTrue(credentialStoreService.containsCredential(CLUSTER_NAME, "test1", CredentialStoreType.PERSISTED));
  Assert.assertFalse(credentialStoreService.containsCredential(CLUSTER_NAME, "test1", CredentialStoreType.TEMPORARY));
  Assert.assertFalse(credentialStoreService.containsCredential(CLUSTER_NAME, "test3", CredentialStoreType.PERSISTED));
  Assert.assertFalse(credentialStoreService.containsCredential(CLUSTER_NAME, "test1", CredentialStoreType.TEMPORARY));
  Assert.assertFalse(credentialStoreService.containsCredential(CLUSTER_NAME, "test3", CredentialStoreType.PERSISTED));
  Assert.assertTrue(credentialStoreService.containsCredential(CLUSTER_NAME, "test3", CredentialStoreType.TEMPORARY));
  Assert.assertTrue(credentialStoreService.containsCredential(CLUSTER_NAME, "test1"));
  Assert.assertTrue(credentialStoreService.containsCredential(CLUSTER_NAME, "test3"));
}