RetrieveThingsResponse extends AbstractCommandResponse<RetrieveThingsResponse> implements
        ThingQueryCommandResponse<RetrieveThingsResponse>, WithNamespace { public static RetrieveThingsResponse of(final List<String> thingsPlainJson, @Nullable final String namespace, final DittoHeaders dittoHeaders) { return new RetrieveThingsResponse(HttpStatusCode.OK, null, thingsPlainJson.stream() .collect(Collectors.joining(",", "[", "]")), namespace, dittoHeaders); } private  RetrieveThingsResponse(final HttpStatusCode statusCode, @Nullable final JsonArray things,
            final String thingsPlainJson, @Nullable final String namespace, final DittoHeaders dittoHeaders); static RetrieveThingsResponse of(final List<String> thingsPlainJson, @Nullable final String namespace,
            final DittoHeaders dittoHeaders); static RetrieveThingsResponse of(final String thingsPlainJson, @Nullable final String namespace,
            final DittoHeaders dittoHeaders); static RetrieveThingsResponse of(final JsonArray things, @Nullable final String namespace,
            final DittoHeaders dittoHeaders); static RetrieveThingsResponse of(final List<Thing> things, final Predicate<JsonField> predicate,
            @Nullable final String namespace, final DittoHeaders dittoHeaders); static RetrieveThingsResponse of(final List<Thing> things, @Nullable final JsonFieldSelector fieldSelector,
            @Nullable final Predicate<JsonField> predicate, @Nullable final String namespace, final DittoHeaders dittoHeaders); static RetrieveThingsResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveThingsResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ThingId getThingEntityId(); @Override Optional<String> getNamespace(); List<Thing> getThings(); @Override Optional<String> getEntityPlainString(); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override RetrieveThingsResponse setEntity(final JsonValue entity); @Override RetrieveThingsResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override JsonPointer getResourcePath(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThings() { RetrieveThingsResponse.of((List<Thing>) null, FieldType.notHidden(), "some.namespace", TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullJsonArray() { RetrieveThingsResponse.of((JsonArray) null, "some.namespace", TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final RetrieveThingsResponse underTest = RetrieveThingsResponse .of(Collections.singletonList(TestConstants.Thing.THING), FieldType.notHidden(), "example.com", TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(); assertThat(actualJson).isEqualTo(KNOWN_JSON); }