RetrieveConnection extends AbstractCommand<RetrieveConnection> implements ConnectivityQueryCommand<RetrieveConnection> { public static RetrieveConnection of(final ConnectionId connectionId, final DittoHeaders dittoHeaders) { checkNotNull(connectionId, "Connection ID"); return new RetrieveConnection(connectionId, dittoHeaders); } private  RetrieveConnection(final ConnectionId connectionId, final DittoHeaders dittoHeaders); static RetrieveConnection of(final ConnectionId connectionId, final DittoHeaders dittoHeaders); static RetrieveConnection fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveConnection fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override ConnectionId getConnectionEntityId(); @Override Category getCategory(); @Override RetrieveConnection 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 createInstanceWithNullConnectionId() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> RetrieveConnection.of(null, DittoHeaders.empty())) .withMessage("The %s must not be null!", "Connection ID") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final JsonObject actual = RetrieveConnection.of(TestConstants.ID, DittoHeaders.empty()).toJson(); assertThat(actual).isEqualTo(KNOWN_JSON); }
@Test public void getResourcePathReturnsExpected() { final JsonPointer expectedResourcePath = JsonFactory.emptyPointer(); final RetrieveConnection underTest = RetrieveConnection.of(TestConstants.ID, DittoHeaders.empty()); DittoJsonAssertions.assertThat(underTest.getResourcePath()).isEqualTo(expectedResourcePath); }