### Question:
PlainMessage extends TypedMessage { public static PlainMessage create(String text) { return new PlainMessage(text); } PlainMessage(String payload); static PlainMessage create(String text);  }### Answer:
@Test void shouldCreatePlainMessageViaStaticConstructor() { PlainMessage plainMessage = PlainMessage.create("test-message"); assertEquals("test-message", plainMessage.getText()); assertSame(MessageType.PLAIN_MESSAGE, plainMessage.getType()); byte[] payload = plainMessage.getPayloadByteBuffer().array(); assertEquals("00746573742D6D657373616765", ConvertUtils.toHex(payload)); PlainMessage anotherPlain = (PlainMessage) Message.createFromPayload(payload).get(); assertEquals(anotherPlain, plainMessage); }
@Test void shouldCreateWhenEmptyMessage() { PlainMessage plainMessage = PlainMessage.create(""); assertEquals("", plainMessage.getText()); assertSame(MessageType.PLAIN_MESSAGE, plainMessage.getType()); byte[] payload = plainMessage.getPayloadByteBuffer().array(); assertEquals("00", ConvertUtils.toHex(payload)); PlainMessage anotherPlain = (PlainMessage) Message.createFromPayload(payload).get(); assertEquals(anotherPlain, plainMessage); }