use of org.cloudfoundry.credhub.entity.Credential in project credhub by cloudfoundry-incubator.
the class CredentialDataServiceTest method find_whenTheCredentialExists_returnsTheCredential.
@Test
public void find_whenTheCredentialExists_returnsTheCredential() {
final Credential credential = new Credential(CREDENTIAL_NAME);
credentialRepository.save(credential);
assertThat(subject.find(CREDENTIAL_NAME), equalTo(credential));
}
use of org.cloudfoundry.credhub.entity.Credential in project credhub by cloudfoundry-incubator.
the class CredentialDataServiceTest method save_savesTheCredential.
@Test
public void save_savesTheCredential() {
final Credential credential = new Credential(CREDENTIAL_NAME);
assertThat(credentialRepository.count(), equalTo(0L));
credentialRepository.save(credential);
assertThat(credentialRepository.count(), equalTo(1L));
assertThat(credentialRepository.findOneByNameIgnoreCase(CREDENTIAL_NAME).getName(), equalTo(CREDENTIAL_NAME));
}
use of org.cloudfoundry.credhub.entity.Credential in project credhub by cloudfoundry-incubator.
the class CredentialDataServiceTest method findByUUID_whenTheCredentialExists_returnsTheCredential.
@Test
public void findByUUID_whenTheCredentialExists_returnsTheCredential() {
final Credential credential = new Credential(CREDENTIAL_NAME);
credentialRepository.save(credential);
assertThat(subject.findByUUID(credential.getUuid()), equalTo(credential));
}
use of org.cloudfoundry.credhub.entity.Credential in project credhub by cloudfoundry-incubator.
the class CredentialDataServiceTest method findAll_whenThereAreCredentials_returnsTheListOfNames.
@Test
public void findAll_whenThereAreCredentials_returnsTheListOfNames() {
credentialRepository.save(new Credential(CREDENTIAL_NAME));
credentialRepository.save(new Credential(CREDENTIAL_NAME2));
List<Credential> credentials = subject.findAll();
List<String> names = credentials.stream().map(Credential::getName).collect(Collectors.toList());
assertThat(names, hasSize(2));
assertThat(names, containsInAnyOrder(CREDENTIAL_NAME, CREDENTIAL_NAME2));
}
Aggregations