RetrieveConnectionLogsResponse extends AbstractCommandResponse<RetrieveConnectionLogsResponse> implements ConnectivityQueryCommandResponse<RetrieveConnectionLogsResponse> { public static RetrieveConnectionLogsResponse of(final ConnectionId connectionId, final Collection<LogEntry> connectionLogs, @Nullable final Instant enabledSince, @Nullable final Instant enabledUntil, final DittoHeaders dittoHeaders) { checkNotNull(connectionId, "Connection ID"); checkNotNull(connectionLogs, "Connection Logs"); return new RetrieveConnectionLogsResponse(connectionId, connectionLogs, enabledSince, enabledUntil, dittoHeaders); } private  RetrieveConnectionLogsResponse(final ConnectionId connectionId, final Collection<LogEntry> connectionLogs,
            @Nullable final Instant enabledSince, @Nullable final Instant enabledUntil,
            final DittoHeaders dittoHeaders); static RetrieveConnectionLogsResponse of(final ConnectionId connectionId,
            final Collection<LogEntry> connectionLogs, @Nullable final Instant enabledSince,
            @Nullable final Instant enabledUntil, final DittoHeaders dittoHeaders); static RetrieveConnectionLogsResponse mergeRetrieveConnectionLogsResponse(
            final RetrieveConnectionLogsResponse first,
            final RetrieveConnectionLogsResponse second); static RetrieveConnectionLogsResponse fromJson(final String jsonString,
            final DittoHeaders dittoHeaders); static RetrieveConnectionLogsResponse fromJson(final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); Collection<LogEntry> getConnectionLogs(); Optional<Instant> getEnabledSince(); Optional<Instant> getEnabledUntil(); @Override ConnectionId getConnectionEntityId(); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override RetrieveConnectionLogsResponse setEntity(final JsonValue entity); @Override RetrieveConnectionLogsResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void retrieveInstanceWithNullConnectionId() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy( () -> RetrieveConnectionLogsResponse.of(null, TestConstants.Logs.ENTRIES, ENABLED_SINCE, ENABLED_UNTIL, EMPTY_HEADERS)) .withMessage("The %s must not be null!", "Connection ID") .withNoCause(); }
@Test public void retrieveInstanceWithNullLogs() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy( () -> RetrieveConnectionLogsResponse.of(TestConstants.ID, null, ENABLED_SINCE, ENABLED_UNTIL, EMPTY_HEADERS)) .withMessage("The %s must not be null!", "Connection Logs") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final JsonObject actual = RetrieveConnectionLogsResponse.of(ID, TestConstants.Logs.ENTRIES, ENABLED_SINCE, ENABLED_UNTIL, EMPTY_HEADERS).toJson(); assertThat(actual).isEqualTo(KNOWN_JSON); }