ModifyFeatureDefinition extends AbstractCommand<ModifyFeatureDefinition> implements ThingModifyCommand<ModifyFeatureDefinition>, WithFeatureId { @Deprecated public static ModifyFeatureDefinition of(final String thingId, final String featureId, final FeatureDefinition definition, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), featureId, definition, dittoHeaders); } private  ModifyFeatureDefinition(final ThingId thingId,
            final String featureId,
            final FeatureDefinition definition,
            final DittoHeaders dittoHeaders); @Deprecated static ModifyFeatureDefinition of(final String thingId,
            final String featureId,
            final FeatureDefinition definition,
            final DittoHeaders dittoHeaders); static ModifyFeatureDefinition of(final ThingId thingId,
            final String featureId,
            final FeatureDefinition definition,
            final DittoHeaders dittoHeaders); static ModifyFeatureDefinition fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ModifyFeatureDefinition fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ThingId getThingEntityId(); FeatureDefinition getDefinition(); @Override String getFeatureId(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override Category getCategory(); @Override ModifyFeatureDefinition setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean changesAuthorization(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String NAME; static final String TYPE; }
@Test public void tryToCreateInstanceWithNullThingIdString() { assertThatExceptionOfType(ThingIdInvalidException.class) .isThrownBy(() -> ModifyFeatureDefinition.of((String) null, TestConstants.Feature.FLUX_CAPACITOR_ID, TestConstants.Feature.FLUX_CAPACITOR_DEFINITION, TestConstants.EMPTY_DITTO_HEADERS)); }
@Test public void tryToCreateInstanceWithNullThingId() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> ModifyFeatureDefinition.of((ThingId) null, TestConstants.Feature.FLUX_CAPACITOR_ID, TestConstants.Feature.FLUX_CAPACITOR_DEFINITION, TestConstants.EMPTY_DITTO_HEADERS)) .withNoCause(); }
@Test public void tryToCreateInstanceWithNullFeatureId() { assertThatNullPointerException() .isThrownBy(() -> ModifyFeatureDefinition.of(TestConstants.Thing.THING_ID, null, TestConstants.Feature.FLUX_CAPACITOR_DEFINITION, TestConstants.EMPTY_DITTO_HEADERS)) .withMessage("The %s must not be null!", "Feature ID") .withNoCause(); }
@Test public void tryToCreateInstanceWithNullDefinition() { assertThatNullPointerException() .isThrownBy(() -> ModifyFeatureDefinition.of(TestConstants.Thing.THING_ID, TestConstants.Feature.FLUX_CAPACITOR_ID, null, TestConstants.EMPTY_DITTO_HEADERS)) .withMessage("The %s must not be null!", "Feature Definition") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final ModifyFeatureDefinition underTest = ModifyFeatureDefinition.of(TestConstants.Thing.THING_ID, TestConstants.Feature.FLUX_CAPACITOR_ID, TestConstants.Feature.FLUX_CAPACITOR_DEFINITION, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }