@Test
public void testSplitAggregateFlow() throws Exception
{
final Apple apple = new Apple();
final Banana banana = new Banana();
final Orange orange = new Orange();
final FruitBowl fruitBowl = new FruitBowl(apple, banana);
fruitBowl.addFruit(orange);
muleContext.getClient().send("vm://split-aggregate-in",
new DefaultMuleMessage(fruitBowl, muleContext));
final MuleMessage result = muleContext.getClient().request("vm://split-aggregate-out",
RECEIVE_TIMEOUT);
assertNotNull(result);
assertTrue(result instanceof MuleMessageCollection);
final MuleMessageCollection coll = (MuleMessageCollection) result;
assertEquals(3, coll.size());
final List<?> results = (List<?>) coll.getPayload();
assertTrue(apple.isBitten());
assertTrue(banana.isBitten());
assertTrue(orange.isBitten());
assertTrue(results.contains(apple));
assertTrue(results.contains(banana));
assertTrue(results.contains(orange));
}