List list = new ArrayList();
ksession.setGlobal( "list",
list );
Person p0 = new Person( "yoda",
0 );
p0.setLikes( "cheddar" );
org.drools.runtime.rule.FactHandle fh0 = ksession.insert( p0 );
Person p1 = new Person( "darth",
15 );
p1.setLikes( "cheddar" );
org.drools.runtime.rule.FactHandle fh1 = ksession.insert( p1 );
Person p2 = new Person( "darth",
25 );
p2.setLikes( "cheddar" );
org.drools.runtime.rule.FactHandle fh2 = ksession.insert( p2 ); // creates activation.
Person p3 = new Person( "darth",
30 );
p3.setLikes( "brie" );
org.drools.runtime.rule.FactHandle fh3 = ksession.insert( p3 );
ksession.fireAllRules();
assertEquals( 2,
list.size() );