final List list = new ArrayList();
ksession.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 = ksession.insert( fact );
ksession.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' ) );
ksession.update( handle,
fact );
ksession.fireAllRules();
assertEquals( 5,
list.size() );
assertEquals( "char object",
list.get( index++ ) );
fact.setObject( null );
ksession.update( handle,
fact );
ksession.fireAllRules();
assertEquals( 6,
list.size() );