AggregatedDevOpsCommandResponse extends AbstractDevOpsCommandResponse<AggregatedDevOpsCommandResponse> implements WithEntity<AggregatedDevOpsCommandResponse> { public static AggregatedDevOpsCommandResponse of(final List<CommandResponse<?>> commandResponses, final String responsesType, final HttpStatusCode httpStatusCode, final DittoHeaders dittoHeaders) { final JsonObject jsonRepresentation = buildJsonRepresentation(commandResponses, dittoHeaders); return new AggregatedDevOpsCommandResponse(jsonRepresentation, responsesType, httpStatusCode, dittoHeaders); } private  AggregatedDevOpsCommandResponse(final JsonObject aggregatedResponses,
            final String responsesType, final HttpStatusCode httpStatusCode, final DittoHeaders dittoHeaders); static AggregatedDevOpsCommandResponse of(final List<CommandResponse<?>> commandResponses,
            final String responsesType, final HttpStatusCode httpStatusCode, final DittoHeaders dittoHeaders); static AggregatedDevOpsCommandResponse of(final JsonObject aggregatedResponses,
            final String responsesType, final HttpStatusCode httpStatusCode, final DittoHeaders dittoHeaders); static AggregatedDevOpsCommandResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static AggregatedDevOpsCommandResponse fromJson(final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); @Override AggregatedDevOpsCommandResponse setDittoHeaders(final DittoHeaders dittoHeaders); String getResponsesType(); @Override AggregatedDevOpsCommandResponse setEntity(final JsonValue entity); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void testAggregatedPiggybackCommandResponseFromListOfCommandResponsesSerialization() { final ChangeLogLevelResponse changeLogLevelResponseForThings1 = ChangeLogLevelResponse.of("things", "1", true, DittoHeaders.empty()); final ChangeLogLevelResponse changeLogLevelResponseForThings2 = ChangeLogLevelResponse.of("things", "2", true, DittoHeaders.empty()); final ChangeLogLevelResponse changeLogLevelResponseForGateway1 = ChangeLogLevelResponse.of("gateway", "1", true, DittoHeaders.empty()); final AggregatedDevOpsCommandResponse aggregatedDevOpsCommandResponse = AggregatedDevOpsCommandResponse.of( Arrays.asList(changeLogLevelResponseForThings1, changeLogLevelResponseForThings2, changeLogLevelResponseForGateway1), RESPONSES_TYPE, HttpStatusCode.OK, DittoHeaders.empty()); final JsonObject responseToJson = aggregatedDevOpsCommandResponse.toJson(); final CommandResponse parsedCommandResponse = underTest.parse(responseToJson, DittoHeaders.empty()); assertThat(parsedCommandResponse).isEqualTo(aggregatedDevOpsCommandResponse); assertThat(parsedCommandResponse.toJson()).isEqualTo(responseToJson); }