@Test
public void getPassword_returnsDecryptedPassword_andOnlyDecryptsOnce() {

  final EncryptedValue encryption = new EncryptedValue(ENCRYPTION_KEY_UUID, ENCRYPTED_PASSWORD, NONCE);
  when(encryptor.decrypt(encryption))
    .thenReturn(USER_PASSWORD);
  final EncryptedValue encryptedValue = new EncryptedValue();
  encryptedValue.setEncryptedValue(ENCRYPTED_PASSWORD);
  encryptedValue.setNonce(NONCE);
  encryptedValue.setEncryptionKeyUuid(ENCRYPTION_KEY_UUID);
  userCredentialData = new UserCredentialVersionData();
  userCredentialData.setEncryptedValueData(encryptedValue);
  subject = new UserCredentialVersion(userCredentialData);
  subject.setEncryptor(encryptor);
  final String password = subject.getPassword();
  assertThat(password, equalTo(USER_PASSWORD));
  verify(encryptor, times(1)).decrypt(any());
}