@Test
public void mapExternalMessageTextAndBytes() {

    final ExternalMessage externalMessage = ExternalMessageFactory
            .newExternalMessageBuilder(new HashMap<>())
            .withTextAndBytes(PAYLOAD, ByteBuffer.wrap(BYTES))
            .build();
    final NativeObject nativeObject = ScriptedIncomingMapping.mapExternalMessageToNativeObject(externalMessage);
    final String textPayload = (String) nativeObject.get("textPayload");
    final NativeArrayBuffer bytePayload = (NativeArrayBuffer) nativeObject.get("bytePayload");
    assertThat(textPayload).isEqualTo(PAYLOAD);
    assertThat(bytePayload.getBuffer()).isEqualTo(BYTES);
}