ModifyThing extends AbstractCommand<ModifyThing> implements ThingModifyCommand<ModifyThing> { @Deprecated public static ModifyThing withCopiedPolicy(final String thingId, final Thing thing, final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders) { return withCopiedPolicy(ThingId.of(thingId), thing, policyIdOrPlaceholder, dittoHeaders); } private  ModifyThing(final ThingId thingId, final Thing thing, @Nullable final JsonObject initialPolicy,
            @Nullable final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders); @Deprecated static ModifyThing of(final String thingId, final Thing thing, @Nullable final JsonObject initialPolicy,
            final DittoHeaders dittoHeaders); static ModifyThing of(final ThingId thingId, final Thing thing, @Nullable final JsonObject initialPolicy,
            final DittoHeaders dittoHeaders); @Deprecated static ModifyThing withCopiedPolicy(final String thingId, final Thing thing,
            final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders); static ModifyThing withCopiedPolicy(final ThingId thingId, final Thing thing,
            final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders); @Deprecated static ModifyThing of(final String thingId, final Thing thing, @Nullable final JsonObject initialPolicy,
            @Nullable final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders); static ModifyThing of(final ThingId thingId, final Thing thing, @Nullable final JsonObject initialPolicy,
            @Nullable final String policyIdOrPlaceholder, final DittoHeaders dittoHeaders); static ModifyThing fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ModifyThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); Thing getThing(); @Override ThingId getThingEntityId(); Optional<JsonObject> getInitialPolicy(); Optional<String> getPolicyIdOrPlaceholder(); @Override JsonPointer getResourcePath(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override Category getCategory(); @Override ModifyThing setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean changesAuthorization(); @Override int hashCode(); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object obj); @Override String toString(); static final String NAME; static final String TYPE; static final JsonFieldDefinition<JsonObject> JSON_INITIAL_POLICY; static final JsonFieldDefinition<String> JSON_POLICY_ID_OR_PLACEHOLDER; static final JsonFieldDefinition<String> JSON_COPY_POLICY_FROM; static final JsonFieldDefinition<JsonObject> JSON_INLINE_POLICY; }
@Test public void toJsonWithPolicyIdToCopyReturnsExpected() { final JsonObject expected = KNOWN_JSON.set(ModifyThing.JSON_POLICY_ID_OR_PLACEHOLDER, POLICY_ID_TO_COPY); final ModifyThing underTest = ModifyThing.withCopiedPolicy(TestConstants.Thing.THING_ID, TestConstants.Thing.THING, POLICY_ID_TO_COPY, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(expected); }