l.add(ex1);
l.add(new FactData("Z", "z", new ArrayList(), false));
l.add(new FactData("Q", "x", new ArrayList(), true));
l.add(new FactData("Q", "y", new ArrayList(), true));
l.add(new RetractFact("y"));
l.add(new CallMethod("x","hello"));
VerifyFact vf1 = new VerifyFact();
VerifyFact vf2 = new VerifyFact();
VerifyRuleFired vr1 = new VerifyRuleFired();
VerifyRuleFired vr2 = new VerifyRuleFired();
l.add(vf1);
l.add(vf2);
l.add(vr1);
l.add(vr2);
ExecutionTrace ex2 = new ExecutionTrace();
l.add(ex2);
VerifyFact vf3 = new VerifyFact();
l.add(vf3);
ScenarioHelper hlp = new ScenarioHelper();
List fx = hlp.lumpyMap(l);
assertEquals(9, fx.size());
Map first = (Map) fx.get(0);
assertEquals(2, first.size());
List fdl = (List) first.get("Q");
assertEquals(2, fdl.size());
FactData fd = (FactData) fdl.get(0);
assertEquals("x", fd.getName());
fd = (FactData) fdl.get(1);
assertEquals("y", fd.getName());
fdl = (List) first.get("X");
assertEquals(2, fdl.size());
fd = (FactData) fdl.get(0);
assertEquals("a", fd.getName());
CallFixtureMap callMap = (CallFixtureMap)fx.get(1);
assertEquals(2, callMap.size());
assertTrue(callMap.containsKey("x"));
FixtureList lcall1 = callMap.get("x");
CallMethod c1 = (CallMethod)lcall1.get(0);
assertTrue(c1.getVariable().equals("x"));
assertTrue(c1.getMethodName().equals("hello"));
CallMethod c2 = (CallMethod)lcall1.get(1);
assertTrue(c2.getVariable().equals("x"));
assertTrue(c2.getMethodName().equals("helloItherWay"));
assertTrue(callMap.containsKey("v"));
FixtureList lcall2 = callMap.get("v");
CallMethod c3= (CallMethod)lcall2.get(0);
assertTrue(c3.getVariable().equals("v"));
assertTrue(c3.getMethodName().equals("helloAgain"));
assertEquals(ex1, fx.get(2));
List ruleFired = (List) fx.get(3);
assertEquals(2, ruleFired.size());
assertEquals(vr1, ruleFired.get(0));
assertEquals(vr2, ruleFired.get(1));
List verifyFact = (List) fx.get(4);
assertEquals(2, verifyFact.size());
assertEquals(vf1, verifyFact.get(0));
assertEquals(vf2, verifyFact.get(1));
Map second = (Map) fx.get(5);
assertEquals(3, second.size());
assertTrue(second.containsKey("Z"));
assertTrue(second.containsKey("Q"));
fdl = (List) second.get("Q");
assertEquals(2, fdl.size());
assertTrue(second.containsKey("retract"));
List retracts = (List) second.get("retract");
assertEquals(1, retracts.size());
RetractFact ret = (RetractFact) retracts.get(0);
assertEquals("y", ret.getName());
CallFixtureMap third = (CallFixtureMap)fx.get(6);
assertEquals(1, third.size());
assertTrue(third.containsKey("x"));