final WorkingMemory workingMemory = ruleBase.newStatefulSession();
final List list = new ArrayList();
workingMemory.setGlobal( "list",
list );
final Cheese cheddar = new Cheese( "cheddar",
5 );
final FactHandle h = workingMemory.insert( cheddar );
workingMemory.fireAllRules();
// just one added
assertEquals( "got cheese",
list.get( 0 ) );
assertEquals( 1,
list.size() );
workingMemory.retract( h );
workingMemory.fireAllRules();
// still just one
assertEquals( 1,
list.size() );
workingMemory.insert( new Cheese( "stilton",
5 ) );
workingMemory.fireAllRules();
// now have one more
assertEquals( 2,