@Test
public void toJsonReturnsExpected() {

    final Connection underTest = ConnectivityModelFactory.newConnectionBuilder(ID, TYPE, STATUS, URI)
            .credentials(CREDENTIALS)
            .name(NAME)
            .sources(addSourceMapping(Arrays.asList(SOURCE2, SOURCE1),
                    JAVA_SCRIPT_MAPPING)) // use different order to test sorting
            .targets(addTargetMapping(TARGETS, STATUS_MAPPING))
            .clientCount(2)
            .payloadMappingDefinition(KNOWN_MAPPING_DEFINITIONS)
            .tags(KNOWN_TAGS)
            .build();
    final JsonObject actual = underTest.toJson();
    assertThat(actual).isEqualTo(KNOWN_JSON_WITH_REPLY_TARGET);
}