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