RetrieveThingResponse extends AbstractCommandResponse<RetrieveThingResponse> implements
        ThingQueryCommandResponse<RetrieveThingResponse> { @Deprecated public static RetrieveThingResponse of(final String thingId, final JsonObject thing, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), thing, dittoHeaders); } private  RetrieveThingResponse(final ThingId thingId, final HttpStatusCode statusCode,
            @Nullable final JsonObject thing, final String thingPlainJson, final DittoHeaders dittoHeaders); @Deprecated static RetrieveThingResponse of(final String thingId, final JsonObject thing,
            final DittoHeaders dittoHeaders); static RetrieveThingResponse of(final ThingId thingId, final JsonObject thing,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveThingResponse of(final String thingId, final String thingPlainJson,
            final DittoHeaders dittoHeaders); static RetrieveThingResponse of(final ThingId thingId, final String thingPlainJson,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveThingResponse of(final String thingId, final Thing thing,
            final DittoHeaders dittoHeaders); static RetrieveThingResponse of(final ThingId thingId, final Thing thing,
            final DittoHeaders dittoHeaders); static RetrieveThingResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveThingResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ThingId getThingEntityId(); Thing getThing(); @Override Optional<String> getEntityPlainString(); @Override JsonObject getEntity(final JsonSchemaVersion schemaVersion); @Override RetrieveThingResponse setEntity(final JsonValue entity); @Override RetrieveThingResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override JsonPointer getResourcePath(); @SuppressWarnings("OverlyComplexMethod") @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThing() { RetrieveThingResponse.of(TestConstants.Thing.THING_ID, (Thing) null, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullJsonObject() { RetrieveThingResponse.of(TestConstants.Thing.THING_ID, (JsonObject) null, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final RetrieveThingResponse underTest = RetrieveThingResponse.of(TestConstants.Thing.THING_ID, TestConstants.Thing.THING, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test public void parseRetrieveThingCommandResponse() { final RetrieveThingResponse commandResponse = RetrieveThingResponse.of(TestConstants.Thing.THING_ID, TestConstants.Thing.THING, TestConstants.DITTO_HEADERS); final JsonObject jsonObject = commandResponse.toJson(FieldType.regularOrSpecial()); final CommandResponse parsedCommandResponse = GlobalCommandResponseRegistry.getInstance().parse(jsonObject, TestConstants.DITTO_HEADERS); assertThat(parsedCommandResponse).isEqualTo(commandResponse); }