@Test
public void shouldReturnEnvelope() throws Exception {

    final JsonEnvelope envelope = jsonObjectEnvelopeConverter.asEnvelope(jsonObjectFromFile("envelope"));
    assertThat(envelope, notNullValue());
    Metadata metadata = envelope.metadata();
    JsonObject payload = envelope.payloadAsJsonObject();
    assertThat(metadata, notNullValue());
    assertThat(payload, notNullValue());
    assertThat(metadata.id().toString(), equalTo(ID));
    assertThat(metadata.name(), equalTo(NAME));
    Optional<String> clientCorrelationId = metadata.clientCorrelationId();
    assertThat(clientCorrelationId.get(), equalTo(CLIENT));
    assertThat(metadata.sessionId().get(), equalTo(SESSION));
    assertThat(metadata.userId().get(), equalTo(USER));
    List<UUID> causation = metadata.causation();
    assertThat(causation, notNullValue());
    assertThat(causation.size(), equalTo(2));
    assertThat(causation.get(0).toString(), equalTo(CAUSATION_1));
    assertThat(causation.get(1).toString(), equalTo(CAUSATION_2));
}