"cheddar" ),
new FieldData( "price",
"42" ) ),
false )};
VerifyFact[] assertions = new VerifyFact[]{new VerifyFact( "c1",
ls( new VerifyField( "type",
"cheddar",
"==" ),
new VerifyField( "price",
"42",
"==" ) ) )};
sc.fixtures.addAll( Arrays.asList( facts ) );
sc.fixtures.addAll( Arrays.asList( assertions ) );
TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
Thread.currentThread().getContextClassLoader() );
resolver.addImport( "org.drools.Cheese" );
MockWorkingMemory wm = new MockWorkingMemory();
ScenarioRunner runner = new ScenarioRunner( sc,
resolver,
wm );
assertEquals( 1,
wm.facts.size() );
assertEquals( runner.populatedData.get( "c1" ),
wm.facts.get( 0 ) );
assertTrue( runner.populatedData.containsKey( "c1" ) );
VerifyFact vf = (VerifyFact) assertions[0];
for ( int i = 0; i < vf.fieldValues.size(); i++ ) {
assertTrue( ((VerifyField) vf.fieldValues.get( i )).successResult );
}
}