@Test
public void setGenerationParameters_setsEncryptedGenerationParametersAndNonce() {

  when(encryptor.encrypt(eq(userGenerationParametersString)))
    .thenReturn(new EncryptedValue(ENCRYPTION_KEY_UUID, ENCRYPTED_GENERATION_PARAMS, PARAMETERS_NONCE));
  userCredentialData = new UserCredentialVersionData(CREDENTIAL_NAME);
  subject = new UserCredentialVersion(userCredentialData);
  subject.setEncryptor(encryptor);
  subject.setGenerationParameters(stringGenerationParameters);
  verify(encryptor, times(1)).encrypt(eq(userGenerationParametersString));
  assertThat(userCredentialData.getEncryptedGenerationParameters().getEncryptionKeyUuid(), equalTo(ENCRYPTION_KEY_UUID));
  assertThat(userCredentialData.getEncryptedGenerationParameters().getEncryptedValue(), equalTo(ENCRYPTED_GENERATION_PARAMS));
  assertThat(userCredentialData.getEncryptedGenerationParameters().getNonce(), equalTo(PARAMETERS_NONCE));
}