public void testSplitAggregateMapFlow() throws MuleException, Exception
{
Map map = new HashMap<String, Fruit>();
final Apple apple = new Apple();
final Banana banana = new Banana();
final Orange orange = new Orange();
map.put("apple", apple);
map.put("banana", banana);
map.put("orange", orange);
MuleEvent result = ((Flow) muleContext.getRegistry().lookupFlowConstruct("split-map")).process(getTestEvent(map));
assertNotNull(result);
assertTrue(result.getMessage() instanceof MuleMessageCollection);
final MuleMessageCollection coll = (MuleMessageCollection) result.getMessage();
assertEquals(3, coll.size());
final MuleMessage[] results = coll.getMessagesAsArray();
assertTrue(apple.isBitten());
assertTrue(banana.isBitten());
assertTrue(orange.isBitten());
assertNotNull(results[0].getProperty("key", PropertyScope.INVOCATION));
assertNotNull(results[1].getProperty("key", PropertyScope.INVOCATION));
assertNotNull(results[2].getProperty("key", PropertyScope.INVOCATION));
}