@Test
public void shouldValidateThePayloadOfAJsonEnvelope() throws Exception {

    final String actionName = "example.action-name";
    final Optional<MediaType> mediaType = of(new MediaType("application/vnd.example.action-name+json"));
    final String payloadJson = "{\"some\": \"json\"}";
    final JsonEnvelope jsonEnvelope = mock(JsonEnvelope.class);
    final JsonValue payload = mock(JsonValue.class);
    when(jsonEnvelope.payload()).thenReturn(payload);
    when(objectMapper.writeValueAsString(payload)).thenReturn(payloadJson);
    envelopeValidator.validate(jsonEnvelope, actionName, mediaType);
    verify(jsonSchemaValidator).validate(
            payloadJson,
            actionName,
            mediaType);
}