### Question:
RawMessage extends Message { @Override public String getText() { return new String(getPayload(), StandardCharsets.UTF_8); } RawMessage(byte[] payload); @Override String getText();  }### Answer:
@Test void createRawMessage() { RawMessage rawMessage = new RawMessage("test-message".getBytes(StandardCharsets.UTF_8)); assertEquals("test-message", rawMessage.getText()); assertSame(MessageType.RAW_MESSAGE, rawMessage.getType()); byte[] payload = rawMessage.getPayloadByteBuffer().array(); assertEquals("746573742D6D657373616765", ConvertUtils.toHex(payload)); RawMessage anotherPlain = (RawMessage) Message.createFromHexPayload(rawMessage.getPayloadHex()).get(); assertEquals(anotherPlain, rawMessage); }
@Test void shouldCreateWhenEmptyMessage() { RawMessage rawMessage = new RawMessage("".getBytes(StandardCharsets.UTF_8)); assertEquals("", rawMessage.getText()); assertSame(MessageType.RAW_MESSAGE, rawMessage.getType()); byte[] payload = rawMessage.getPayloadByteBuffer().array(); assertEquals("", ConvertUtils.toHex(payload)); Assertions.assertFalse(Message.createFromPayload(payload).isPresent()); }