35263527352835293530353135323533353435353536
p2.setStringAttribute( "a" ); workingMemory.insert( p1 ); workingMemory.insert( p2 ); workingMemory.fireAllRules(); assertEquals( 3, results.size() ); assertEquals( "1", results.get( 0 ) );
35593560356135623563356435653566356735683569
Person p1 = new Person( "bob", 5 ); workingMemory.insert( p1 ); workingMemory.fireAllRules(); assertEquals( 2, results.size() ); assertEquals( "1", results.get( 0 ) );
35873588358935903591359235933594359535963597
final List list = new ArrayList(); workingMemory.setGlobal( "results", list ); workingMemory.fireAllRules(); assertEquals( 1, list.size() ); assertEquals( 10,
36123613361436153616361736183619362036213622
36363637363836393640364136423643364436453646
workingMemory.setGlobal( "results", results ); workingMemory.insert( new Cheese() ); workingMemory.fireAllRules(); assertEquals( 0, results.size() ); }
36883689369036913692369336943695369636973698
workingMemory.insert( new Cheese( "stilton", 10 ) ); workingMemory.insert( new Cheese( "brie", 5 ) ); workingMemory.fireAllRules(); assertEquals( results.toString(), 2, results.size() ); assertTrue( results.contains( "p1.r1" ) );
37523753375437553756375737583759376037613762
workingMemory.insert( new Cheese( "stilton", 10 ) ); workingMemory.insert( new Cheese( "brie", 5 ) ); workingMemory.fireAllRules(); assertEquals( results.toString(), 0, results.size() );
37613762376337643765376637673768376937703771
results.size() ); workingMemory.insert( new Cheese( "muzzarella", 7 ) ); workingMemory.fireAllRules(); assertEquals( results.toString(), 1, results.size() ); assertTrue( results.contains( "p1.r3" ) );
37923793379437953796379737983799380038013802
results ); workingMemory.insert( new Cheese( "stilton", 15 ) ); workingMemory.fireAllRules(); assertEquals( 2, results.size() ); assertEquals( "stilton", results.get( 0 ) );
38243825382638273828382938303831383238333834
10 ) ); workingMemory.setGlobal( "cheesery", cheesery ); workingMemory.fireAllRules(); assertEquals( 2, results.size() ); assertEquals( 2, ((List) results.get( 0 )).size() );