orderedFacts );
workingMemory.setGlobal( "errors",
errors );
final int MAX = 2;
for ( int i = 1; i <= MAX; i++ ) {
final IndexedNumber n = new IndexedNumber( i,
MAX - i + 1 );
workingMemory.insert( n );
}
workingMemory.fireAllRules();
Assert.assertTrue( "Processing generated errors: " + errors.toString(),
errors.isEmpty() );
for ( int i = 1; i <= MAX; i++ ) {
final IndexedNumber n = (IndexedNumber) orderedFacts.get( i - 1 );
Assert.assertEquals( "Fact is out of order",
i,
n.getIndex() );
}
} finally {
logger.writeToDisk();
}
}