ModifyThingDefinition extends AbstractCommand<ModifyThingDefinition> implements ThingModifyCommand<ModifyThingDefinition> { public static ModifyThingDefinition of(final ThingId thingId, final ThingDefinition definition, final DittoHeaders dittoHeaders) { return new ModifyThingDefinition(thingId, definition, dittoHeaders); } private  ModifyThingDefinition(final ThingId thingId, final ThingDefinition definition,
            final DittoHeaders dittoHeaders); static ModifyThingDefinition of(final ThingId thingId, final ThingDefinition definition,
            final DittoHeaders dittoHeaders); static ModifyThingDefinition fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ModifyThingDefinition fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override JsonSchemaVersion[] getSupportedSchemaVersions(); ThingDefinition getDefinition(); @Override ThingId getThingEntityId(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override Category getCategory(); @Override ModifyThingDefinition setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean changesAuthorization(); @Override int hashCode(); @SuppressWarnings({"squid:MethodCyclomaticComplexity", "squid:S1067", "OverlyComplexMethod"}) @Override boolean equals(@Nullable final Object obj); @Override String toString(); static final String NAME; static final String TYPE; }
@Test public void toJsonReturnsExpected() { final ModifyThingDefinition underTest = ModifyThingDefinition.of(TestConstants.Thing.THING_ID, KNOWN_DEFINITION, DittoHeaders.empty()); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test public void toJsonWithNullDefinitionReturnsExpected() { final ModifyThingDefinition underTest = ModifyThingDefinition.of(TestConstants.Thing.THING_ID, NULL_DEFINITION, DittoHeaders.empty()); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON_WITH_NULL_DEFINITION); }