RetrieveFeature extends AbstractCommand<RetrieveFeature> implements
        ThingQueryCommand<RetrieveFeature>, WithFeatureId { @Deprecated public static RetrieveFeature of(final String thingId, final String featureId, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), featureId, dittoHeaders); } private  RetrieveFeature(final ThingId thingId,
            final String featureId,
            @Nullable final JsonFieldSelector theSelectedFields,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveFeature of(final String thingId, final String featureId, final DittoHeaders dittoHeaders); static RetrieveFeature of(final ThingId thingId, final String featureId,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveFeature of(final String thingId,
            final String featureId,
            @Nullable final JsonFieldSelector selectedFields,
            final DittoHeaders dittoHeaders); static RetrieveFeature of(final ThingId thingId,
            final String featureId,
            @Nullable final JsonFieldSelector selectedFields,
            final DittoHeaders dittoHeaders); static RetrieveFeature fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveFeature fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override Optional<JsonFieldSelector> getSelectedFields(); @Override ThingId getThingEntityId(); @Override String getFeatureId(); @Override JsonPointer getResourcePath(); @Override RetrieveFeature setDittoHeaders(final DittoHeaders dittoHeaders); @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 RetrieveFeature underTest = RetrieveFeature.of(TestConstants.Thing.THING_ID, TestConstants.Feature.FLUX_CAPACITOR_ID, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test public void jsonSerializationWorksAsExpectedWithSelectedFields() { final RetrieveFeature underTest = RetrieveFeature.of(TestConstants.Thing.THING_ID, TestConstants.Feature.FLUX_CAPACITOR_ID, getJsonFieldSelector(), TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON_WITH_FIELD_SELECTION); }