### Question:
MessageAggregationStrategy implements AggregationStrategy { @Override public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { return newExchange; } var in1 = (String) oldExchange.getIn().getBody(); var in2 = (String) newExchange.getIn().getBody(); oldExchange.getIn().setBody(in1 + ";" + in2); return oldExchange; }  @Override Exchange aggregate(Exchange oldExchange, Exchange newExchange);  }### Answer:
@Test public void testAggregate() { var mas = new MessageAggregationStrategy(); var oldExchange = new DefaultExchange((CamelContext) null); oldExchange.getIn().setBody("TEST1"); var newExchange = new DefaultExchange((CamelContext) null); newExchange.getIn().setBody("TEST2"); var output = mas.aggregate(oldExchange, newExchange); var outputBody = (String) output.getIn().getBody(); assertEquals("TEST1;TEST2", outputBody); }
@Test public void testAggregateOldNull() { var mas = new MessageAggregationStrategy(); var newExchange = new DefaultExchange((CamelContext) null); newExchange.getIn().setBody("TEST2"); var output = mas.aggregate(null, newExchange); var outputBody = (String) output.getIn().getBody(); assertEquals(newExchange, output); assertEquals("TEST2", outputBody); }