message2.setCorrelationId(message1.getUniqueId());
message3.setCorrelationId(message1.getUniqueId());
message1.setCorrelationGroupSize(3);
InboundEndpoint endpoint = MuleTestUtils.getTestInboundEndpoint(MessageExchangePattern.ONE_WAY, muleContext);
MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, session);
MuleEvent event2 = new DefaultMuleEvent(message2, endpoint, session);
MuleEvent event3 = new DefaultMuleEvent(message3, endpoint, session);
assertNull(router.process(event1));
assertNull(router.process(event2));
MuleEvent resultEvent = router.process(event3);
assertNotNull(resultEvent);
MuleMessage resultMessage = resultEvent.getMessage();
assertNotNull(resultMessage);
List<String> payload = (List<String>)resultMessage.getPayload();
assertEquals(3, payload.size());
assertEquals("test event A", payload.get(0));
assertEquals("test event B", payload.get(1));