RetrieveAttributeResponse extends AbstractCommandResponse<RetrieveAttributeResponse> implements
        ThingQueryCommandResponse<RetrieveAttributeResponse> { @Deprecated public static RetrieveAttributeResponse of(final String thingId, final JsonPointer attributePointer, final JsonValue attributeValue, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), attributePointer, attributeValue, dittoHeaders); } private  RetrieveAttributeResponse(final ThingId thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final HttpStatusCode statusCode,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveAttributeResponse of(final String thingId, final JsonPointer attributePointer,
            final JsonValue attributeValue, final DittoHeaders dittoHeaders); static RetrieveAttributeResponse of(final ThingId thingId, final JsonPointer attributePointer,
            final JsonValue attributeValue, final DittoHeaders dittoHeaders); static RetrieveAttributeResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveAttributeResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ThingId getThingEntityId(); JsonValue getAttributeValue(); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override RetrieveAttributeResponse setEntity(final JsonValue entity); @Override RetrieveAttributeResponse 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 tryToCreateInstanceWithNullAttribute() { RetrieveAttributeResponse.of(TestConstants.Thing.THING_ID, TestConstants.Thing.LOCATION_ATTRIBUTE_POINTER, null, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final RetrieveAttributeResponse underTest = RetrieveAttributeResponse.of(TestConstants.Thing.THING_ID, TestConstants.Thing.LOCATION_ATTRIBUTE_POINTER, TestConstants.Thing.LOCATION_ATTRIBUTE_VALUE, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test(expected = JsonKeyInvalidException.class) public void createInstanceFromInvalidArguments() { RetrieveAttributeResponse.of(TestConstants.Thing.THING_ID, INVALID_JSON_POINTER, TestConstants.Thing.LOCATION_ATTRIBUTE_VALUE, TestConstants.EMPTY_DITTO_HEADERS); }