final List list = new ArrayList();
workingMemory.setGlobal( "results",
list );
final PolymorphicFact fact = new PolymorphicFact( new Integer( 10 ) );
final FactHandle handle = workingMemory.insert( fact );
workingMemory.fireAllRules();
assertEquals( 1, list.size() );
assertEquals( fact.getData(), list.get( 0 ) );
fact.setData( "10" );
workingMemory.update( handle, fact );
workingMemory.fireAllRules();
assertEquals( 2, list.size() );
assertEquals( fact.getData(), list.get( 1 ) );
try {
fact.setData( new Boolean(true) );
workingMemory.update( handle, fact );
fail("Should not allow to compare < with a Boolean object");
} catch( ClassCastException cce ) {
// success, as can't use "<" to compare to a boolean
}