RetrieveConnectionMetricsResponse extends AbstractCommandResponse<RetrieveConnectionMetricsResponse> implements ConnectivityQueryCommandResponse<RetrieveConnectionMetricsResponse> { public static Builder getBuilder(final ConnectionId connectionId, final DittoHeaders dittoHeaders){ return new Builder(connectionId, dittoHeaders); } private  RetrieveConnectionMetricsResponse(final ConnectionId connectionId, final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); static RetrieveConnectionMetricsResponse of(final ConnectionId connectionId, final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); static RetrieveConnectionMetricsResponse fromJson(final String jsonString,
            final DittoHeaders dittoHeaders); static RetrieveConnectionMetricsResponse fromJson(final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); Optional<Boolean> getContainsFailure(); ConnectionMetrics getConnectionMetrics(); SourceMetrics getSourceMetrics(); TargetMetrics getTargetMetrics(); @Override ConnectionId getConnectionEntityId(); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override RetrieveConnectionMetricsResponse setEntity(final JsonValue entity); @Override RetrieveConnectionMetricsResponse setDittoHeaders(final DittoHeaders dittoHeaders); static Builder getBuilder(final ConnectionId connectionId, final DittoHeaders dittoHeaders); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void retrieveInstanceWithNullConnectionId() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy( () -> RetrieveConnectionMetricsResponse.getBuilder(null, DittoHeaders.empty()) .connectionMetrics(METRICS) .sourceMetrics(EMPTY_SOURCE_METRICS) .targetMetrics(EMPTY_TARGET_METRICS) .build()) .withMessage("The %s must not be null!", "Connection ID") .withNoCause(); }
@Test public void toJsonReturnsExpected() { final JsonObject actual = RetrieveConnectionMetricsResponse.getBuilder(ID, DittoHeaders.empty()) .connectionMetrics(Metrics.CONNECTION_METRICS) .sourceMetrics(Metrics.SOURCE_METRICS1) .targetMetrics(Metrics.TARGET_METRICS1) .build().toJson(); assertThat(actual).isEqualTo(KNOWN_JSON); }