final List list = new ArrayList();
workingMemory.setGlobal( "results",
list );
final Primitives fact = new Primitives();
fact.setBooleanPrimitive( true );
fact.setBooleanWrapper( new Boolean( true ) );
fact.setObject( new Boolean( true ) );
fact.setCharPrimitive( 'X' );
final FactHandle handle = workingMemory.insert( fact );
workingMemory.fireAllRules();
int index = 0;
assertEquals( list.toString(),
4,
list.size() );
assertEquals( "boolean",
list.get( index++ ) );
assertEquals( "boolean wrapper",
list.get( index++ ) );
assertEquals( "boolean object",
list.get( index++ ) );
assertEquals( "char",
list.get( index++ ) );
fact.setBooleanPrimitive( false );
fact.setBooleanWrapper( null );
fact.setCharPrimitive( '\0' );
fact.setObject( new Character( 'X' ) );
workingMemory.update( handle,
fact );
workingMemory.fireAllRules();
assertEquals( 5,
list.size() );
assertEquals( "char object",
list.get( index++ ) );
fact.setObject( null );
workingMemory.update( handle,
fact );
workingMemory.fireAllRules();
assertEquals( 6,
list.size() );