SendThingMessage extends AbstractMessageCommand<T, SendThingMessage<T>> { @Deprecated public static <T> SendThingMessage<T> of(final String thingId, final Message<T> message, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), message, dittoHeaders); } private  SendThingMessage(final ThingId thingId, final Message<T> message, final DittoHeaders dittoHeaders); @Override SendThingMessage setDittoHeaders(final DittoHeaders dittoHeaders); @Deprecated static SendThingMessage<T> of(final String thingId, final Message<T> message,
            final DittoHeaders dittoHeaders); static SendThingMessage<T> of(final ThingId thingId, final Message<T> message,
            final DittoHeaders dittoHeaders); static SendThingMessage<?> fromJson(final String jsonString, final DittoHeaders dittoHeaders); static SendThingMessage<?> fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override String toString(); static final String NAME; static final String TYPE; }
@Test(expected = org.eclipse.ditto.model.things.ThingIdInvalidException.class) public void tryCreateWithNullThingIdString() { SendThingMessage.of((String) null, MESSAGE, DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryCreateWithNullThingId() { SendThingMessage.of((ThingId) null, MESSAGE, DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryCreateWithNullMessage() { SendThingMessage.of(THING_ID, null, DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryCreateWithNullDittoHeaders() { SendThingMessage.of(THING_ID, MESSAGE, null); }
@Test public void tryCreateValidMessage() { SendThingMessage.of(THING_ID, MESSAGE, DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final SendThingMessage<?> underTest = SendThingMessage.of(THING_ID, MESSAGE, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test public void toJsonWithEmptyPayloadReturnsExpected() { final SendThingMessage<?> underTest = SendThingMessage.of(THING_ID, MESSAGE_EMPTY_PAYLOAD, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON_WITH_EMPTY_PAYLOAD); }