public void shouldEnvelopeObjectWithName() throws JsonProcessingException {
when(envelope.metadata()).thenReturn(
metadataOf(COMMAND_UUID, TEST_NAME)
.withCausation(OLD_CAUSATION_ID)
.build());
<BUG>when(objectToJsonValueConverter.convert(object)).thenReturn(payload);
JsonEnvelope event = enveloper.withMetadataFrom(envelope, TEST_NAME).apply(object);</BUG>
assertThat(event.payload(), equalTo(payload));
assertThat(event.metadata().id(), notNullValue());
assertThat(event.metadata().name(), equalTo(TEST_NAME));

public void shouldEnvelopeObjectWithName() throws JsonProcessingException {
when(envelope.metadata()).thenReturn(
metadataOf(COMMAND_UUID, TEST_NAME)
.withCausation(OLD_CAUSATION_ID)
.build());
when(objectToJsonValueConverter.convert(object)).thenReturn(payload);
when(clock.now()).thenReturn(ZonedDateTime.now());
JsonEnvelope event = enveloper.withMetadataFrom(envelope, TEST_NAME).apply(object);
assertThat(event.payload(), equalTo(payload));
assertThat(event.metadata().id(), notNullValue());
assertThat(event.metadata().name(), equalTo(TEST_NAME));
