CountThings extends AbstractCommand<CountThings> implements ThingSearchQueryCommand<CountThings> { public static CountThings of(@Nullable final String filter, @Nullable final Set<String> namespaces, final DittoHeaders dittoHeaders) { return new CountThings(dittoHeaders, filter, namespaces); } private  CountThings(final DittoHeaders dittoHeaders, @Nullable final String filter,
            @Nullable final Collection<String> namespaces); static CountThings of(@Nullable final String filter, @Nullable final Set<String> namespaces,
            final DittoHeaders dittoHeaders); static CountThings of(final DittoHeaders dittoHeaders); static CountThings fromJson(final String jsonString, final DittoHeaders dittoHeaders); static CountThings fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override Optional<String> getFilter(); @Override Optional<Set<String>> getNamespaces(); @Override CountThings setNamespaces(@Nullable final Collection<String> namespaces); @Override CountThings setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String NAME; static final String TYPE; }
@Test public void toJsonWithAllFieldsSetV2() { final CountThings command = CountThings.of(TestConstants.KNOWN_FILTER_STR, TestConstants.KNOWN_NAMESPACES_SET, DittoHeaders.empty()); final String json = command.toJsonString(); assertThat(json).isEqualTo(JSON_ALL_FIELDS_V2); }
@Test public void toJsonWithAllFieldsSetV1() { final CountThings command = CountThings.of(TestConstants.KNOWN_FILTER_STR, TestConstants.KNOWN_NAMESPACES_SET, DittoHeaders.empty()); final String json = command.toJsonString(JsonSchemaVersion.V_1, FieldType.regularOrSpecial()); assertThat(json).isEqualTo(JSON_ALL_FIELDS_V1); }
@Test public void toJsonWithOnlyRequiredFieldsSetV1() { final CountThings command = CountThings.of(DittoHeaders.empty()); final String json = command.toJsonString(JsonSchemaVersion.V_1, FieldType.regularOrSpecial()); assertThat(json).isEqualTo(JSON_MINIMAL_V1); }
@Test public void toJsonWithOnlyRequiredFieldsSetV2() { final CountThings command = CountThings.of(DittoHeaders.empty()); final String json = command.toJsonString(); assertThat(json).isEqualTo(JSON_MINIMAL_V2); }