### Question:
CompositeSagaResponse implements SagaResponse { @Override public String body() { StringBuffer result = new StringBuffer(); if (responses.size() == 0) { result.append("{}"); } else { result.append("["); for (SagaResponse response : responses) { result.append(response.body()); result.append(", "); } result.delete(result.length()-2, result.length()); result.append("]"); } return result.toString(); } CompositeSagaResponse(Collection<SagaResponse> responses); @Override boolean succeeded(); @Override String body(); Collection<SagaResponse> responses();  }### Answer:
@Test public void bodyCombinesAllResponseBodies() throws Exception { when(response1.body()).thenReturn("{\n" + " \"status\": 500,\n" + " \"body\" : \"oops\"\n" + "}\n"); when(response2.body()).thenReturn("{\n" + " \"status\": 200,\n" + " \"body\" : \"blah\"\n" + "}\n"); assertThat(compositeSagaResponse.body(), is("[{\n" + " \"status\": 500,\n" + " \"body\" : \"oops\"\n" + "}\n" + ", {\n" + " \"status\": 200,\n" + " \"body\" : \"blah\"\n" + "}\n" + "]")); }
@Test public void EmptyCompositeSagaResponse() { assertThat(emptySagaResponse.body(), is("{}")); }