// check sink is empty
assertLength( 0,
sink.getAsserted() );
// check alpha memory is empty
final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( alphaNode );
assertEquals( 0,
memory.size() );
// object should assert as it passes text
alphaNode.assertObject( f0,
context,
workingMemory );
assertEquals( 1,
sink.getAsserted().size() );
assertEquals( 0,
memory.size() );
Object[] list = (Object[]) sink.getAsserted().get( 0 );
assertSame( cheddar,
workingMemory.getObject( (DefaultFactHandle) list[0] ) );
assertFalse( "Should not contain 'cheddar handle'",
memory.contains( f0 ) );
final Cheese stilton = new Cheese( "stilton",
6 );
final DefaultFactHandle f1 = new DefaultFactHandle( 1,
stilton );
// object should NOT assert as it does not pass test
alphaNode.assertObject( f1,
context,
workingMemory );
assertLength( 1,
sink.getAsserted() );
assertEquals( 0,
memory.size() );
list = (Object[]) sink.getAsserted().get( 0 );
assertSame( cheddar,
workingMemory.getObject( (DefaultFactHandle) list[0] ) );
assertFalse( "Should not contain 'cheddar handle'",
memory.contains( f0 ) );
}