StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
List<Integer> list = new ArrayList<Integer>();
ksession.setGlobal("list", list);
Person p1 = new Person("AAA", 31);
Person p2 = new Person("AAA", 34);
Person p3 = new Person("AAA", 33);
FactHandle fh1 = ksession.insert(p1);
FactHandle fh3 = ksession.insert(p3);
FactHandle fh2 = ksession.insert(p2);
ksession.fireAllRules();
assertEquals(1, list.size());
assertEquals(31, (int)list.get(0));
list.clear();
p1.setAge(35);
ksession.update(fh1, p1);
p3.setAge(31);
ksession.update(fh3, p3);
ksession.fireAllRules();
assertEquals(1, list.size());
assertEquals(31, (int)list.get(0));