@Test
public void testDefaultJavascriptOutgoingMappingWithStatus() {

    final ThingId thingId = ThingId.of("org.eclipse.ditto:foo-bar-plain");
    final String correlationId = UUID.randomUUID().toString();
    final Thing newThing = Thing.newBuilder()
            .setId(thingId)
            .setAttributes(Attributes.newBuilder().set("foo", "bar").build())
            .build();
    final CreateThingResponse createThingResponse = CreateThingResponse.of(newThing, DittoHeaders.newBuilder()
            .correlationId(correlationId)
            .putHeader("subject", "{{topic:action-subject}}")
            .build());
    System.out.println(
            "HEADERS: " + ProtocolFactory.newHeadersWithDittoContentType(createThingResponse.getDittoHeaders()));
    System.out.println("CREATE THING RESPONSE :" + createThingResponse);
    final Adaptable adaptable = DittoProtocolAdapter.newInstance().toAdaptable(createThingResponse);
    final JsonifiableAdaptable jsonifiableAdaptable = ProtocolFactory.wrapAsJsonifiableAdaptable(adaptable);
    final long startTs = System.nanoTime();
    System.out.println("ADAPTABLE: " + jsonifiableAdaptable);
    System.out.println("ADAPTABLE TO JSON: " + jsonifiableAdaptable.toJsonString());
    final List<ExternalMessage> rawMessageOpt = javaScriptRhinoMapperDefault.map(adaptable);
    final ExternalMessage rawMessage = rawMessageOpt.get(0);
    System.out.println(rawMessage.getHeaders());
    System.out.println(rawMessage);
    System.out.println("testDefaultJavascriptOutgoingMappingWithStatus Duration: " +
            (System.nanoTime() - startTs) / 1000000.0 + "ms");
    assertThat(rawMessage.findContentType()).contains(DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE);
    assertThat(rawMessage.findHeader(HEADER_CORRELATION_ID)).contains(correlationId);
    assertThat(rawMessage.isTextMessage()).isTrue();
    final String textPayload = rawMessage.getTextPayload().get();
    final JsonObject jsonPayload = JsonFactory.readFrom(textPayload).asObject();
    DittoJsonAssertions.assertThat(jsonPayload).isEqualToIgnoringFieldDefinitions(jsonifiableAdaptable.toJson());
}