ModifyThingResponse extends AbstractCommandResponse<ModifyThingResponse> implements ThingModifyCommandResponse<ModifyThingResponse> { public static ModifyThingResponse created(final Thing thing, final DittoHeaders dittoHeaders) { final ThingId thingId = thing.getEntityId().orElseThrow(() -> new NullPointerException("Thing has no ID!")); return new ModifyThingResponse(thingId, HttpStatusCode.CREATED, thing, dittoHeaders); } private  ModifyThingResponse(final ThingId thingId,
            final HttpStatusCode statusCode,
            @Nullable final Thing thingCreated,
            final DittoHeaders dittoHeaders); static ModifyThingResponse created(final Thing thing, final DittoHeaders dittoHeaders); @Deprecated static ModifyThingResponse modified(final String thingId, final DittoHeaders dittoHeaders); static ModifyThingResponse modified(final ThingId thingId, final DittoHeaders dittoHeaders); static ModifyThingResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ModifyThingResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ThingId getThingEntityId(); Optional<Thing> getThingCreated(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override ModifyThingResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void parseModifyThingCommandResponse() { final ModifyThingResponse commandResponse = ModifyThingResponse.created(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); }