RetrieveConnectionResponse extends AbstractCommandResponse<RetrieveConnectionResponse> implements ConnectivityQueryCommandResponse<RetrieveConnectionResponse> { public static RetrieveConnectionResponse of(final JsonObject connection, final DittoHeaders dittoHeaders) { checkNotNull(connection, "Connection"); return new RetrieveConnectionResponse(connection, dittoHeaders); } private  RetrieveConnectionResponse(final JsonObject jsonObject, final DittoHeaders dittoHeaders); static RetrieveConnectionResponse of(final JsonObject connection, final DittoHeaders dittoHeaders); static RetrieveConnectionResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveConnectionResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); JsonObject getJsonObject(); @Override ConnectionId getConnectionEntityId(); @Override RetrieveConnectionResponse setEntity(final JsonValue entity); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override RetrieveConnectionResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void retrieveInstanceWithNullConnection() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> RetrieveConnectionResponse.of(null, DittoHeaders.empty())) .withMessage("The %s must not be null!", "Connection") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final JsonObject actual = RetrieveConnectionResponse.of(TestConstants.CONNECTION.toJson(), DittoHeaders.empty()).toJson(); assertThat(actual).isEqualTo(KNOWN_JSON); }
@Test public void getResourcePathReturnsExpected() { final JsonPointer expectedResourcePath = JsonFactory.emptyPointer(); final RetrieveConnectionResponse underTest = RetrieveConnectionResponse.of(TestConstants.CONNECTION.toJson(), DittoHeaders.empty()); DittoJsonAssertions.assertThat(underTest.getResourcePath()).isEqualTo(expectedResourcePath); }