OpenConnectionResponse extends AbstractCommandResponse<OpenConnectionResponse> implements ConnectivityModifyCommandResponse<OpenConnectionResponse> { public static OpenConnectionResponse of(final ConnectionId connectionId, final DittoHeaders dittoHeaders) { checkNotNull(connectionId, "Connection ID"); return new OpenConnectionResponse(connectionId, dittoHeaders); } private  OpenConnectionResponse(final ConnectionId connectionId, final DittoHeaders dittoHeaders); static OpenConnectionResponse of(final ConnectionId connectionId, final DittoHeaders dittoHeaders); static OpenConnectionResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static OpenConnectionResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ConnectionId getConnectionEntityId(); @Override JsonPointer getResourcePath(); @Override OpenConnectionResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void createInstanceWithNullConnectionId() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> OpenConnectionResponse.of(null, DittoHeaders.empty())) .withMessage("The %s must not be null!", "Connection ID") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final JsonObject actual = OpenConnectionResponse.of(TestConstants.ID, DittoHeaders.empty()).toJson(); assertThat(actual).isEqualTo(KNOWN_JSON); }