int seq = 0;
List list = new ArrayList();
ksession.setGlobal("list", list);
ksession.insert( new StockTick( seq++, "AAA", 10.0, 10L ) );
ksession.fireAllRules();
assertEquals(list, Arrays.asList(1));
ksession.insert(new StockTick(seq++, "AAA", 15.0, 10L));
ksession.fireAllRules();
assertEquals( list, Arrays.asList( 1, 2 ) );
ksession.insert( new StockTick( seq++, "CCC", 10.0, 10L ) );
ksession.fireAllRules();
assertEquals( list, Arrays.asList( 1, 2, 1 ) );
System.out.println(" ___________________________________- ");
ksession.insert( new StockTick( seq++, "DDD", 13.0, 20L ) );
ksession.fireAllRules();
assertEquals( list, Arrays.asList( 1, 2, 1, 1 ) );
ksession.insert( new StockTick( seq++, "AAA", 11.0, 20L ) );
ksession.fireAllRules();
assertEquals(list, Arrays.asList(1, 2, 1, 1, 3));
// NPE Here
ksession.fireAllRules();