@Test
public void fromJsonWithLegacyMappingContextReturnsExpected() {

    final Map<String, MappingContext> definitions = new HashMap<>(KNOWN_MAPPING_DEFINITIONS.getDefinitions());
    definitions.putAll(LEGACY_MAPPINGS.getDefinitions());
    final Connection expected = ConnectivityModelFactory.newConnectionBuilder(ID, TYPE, STATUS, URI)
            .credentials(CREDENTIALS)
            .name(NAME)
            .setSources(addSourceMapping(SOURCES, JAVA_SCRIPT_MAPPING, "javascript"))
            .setTargets(addTargetMapping(TARGETS, STATUS_MAPPING, "javascript"))
            .clientCount(2)
            .payloadMappingDefinition(ConnectivityModelFactory.newPayloadMappingDefinition(definitions))
            .tags(KNOWN_TAGS)
            .build();
    final Connection actual = ImmutableConnection.fromJson(KNOWN_LEGACY_JSON);
    assertThat(actual).isEqualTo(expected);
}