### Question:
RestfulClientProvisioner implements ClientProvisioner { byte[] activateCredential(final IdentityResponseEnvelope response, final String uuid) { byte[] asymmetricContents = response.getAsymmetricContents(); byte[] symmetricContents = structConverter.convert(response.getSymmetricAttestation()); return tpm.activateIdentity(asymmetricContents, symmetricContents, uuid); }  @EventListener @SuppressFBWarnings(value = "DM_EXIT", justification = "need to exit app from spring managed class here") final void handleContextInitialized(final ContextRefreshedEvent event); @Override boolean provision();  }### Answer:
@Test public void testActivateCredential() { String uuid = "uuid"; byte[] asymmetricContents = new byte[]{1}; byte[] symmetricContents = new byte[]{2}; byte[] response = new byte[]{3}; IdentityResponseEnvelope envelope = mock(IdentityResponseEnvelope.class); SymmetricAttestation attestation = mock(SymmetricAttestation.class); when(envelope.getAsymmetricContents()).thenReturn(asymmetricContents); when(envelope.getSymmetricAttestation()).thenReturn(attestation); when(mockTpm.activateIdentity(asymmetricContents, symmetricContents, uuid)) .thenReturn(response); when(mockStructConverter.convert(attestation)).thenReturn(symmetricContents); provisioner.activateCredential(envelope, uuid); verify(mockTpm).activateIdentity(asymmetricContents, symmetricContents, uuid); verify(envelope).getAsymmetricContents(); verify(envelope).getSymmetricAttestation(); verify(mockStructConverter).convert(attestation); verifyNoMoreInteractions(envelope, attestation); }