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