33 );
runner.getPopulatedData().put( "f2",
f2 );
// test all true
VerifyFact vf = new VerifyFact();
vf.setName("f1");
vf.setFieldValues( ls( new VerifyField( "type",
"cheddar",
"==" ),
new VerifyField( "price",
"42",
"==" ) ) );
runner.verify( vf );
for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
}
vf = new VerifyFact();
vf.setName("f2");
vf.setFieldValues( ls( new VerifyField( "name",
"michael",
"==" ),
new VerifyField( "age",
"33",
"==" ) ) );
runner.verify( vf );
for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
}
// test one false
vf = new VerifyFact();
vf.setName("f2");
vf.setFieldValues( ls( new VerifyField( "name",
"mark",
"==" ),
new VerifyField( "age",
"33",
"==" ) ) );
runner.verify( vf );
assertFalse( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );
assertTrue( ((VerifyField) vf.getFieldValues().get( 1 )).getSuccessResult() );
assertEquals( "michael",
((VerifyField) vf.getFieldValues().get( 0 )).getActualResult() );
assertEquals( "mark",
((VerifyField) vf.getFieldValues().get( 0 )).getExpected() );
// test 2 false
vf = new VerifyFact();
vf.setName("f2");
vf.setFieldValues( ls( new VerifyField( "name",
"mark",
"==" ),
new VerifyField( "age",
"32",
"==" ) ) );
runner.verify( vf );
assertFalse( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );
assertFalse( ((VerifyField) vf.getFieldValues().get( 1 )).getSuccessResult() );
assertEquals( "michael",
((VerifyField) vf.getFieldValues().get( 0 )).getActualResult() );
assertEquals( "mark",
((VerifyField) vf.getFieldValues().get( 0 )).getExpected() );
assertEquals( "33",
((VerifyField) vf.getFieldValues().get( 1 )).getActualResult() );
assertEquals( "32",
((VerifyField) vf.getFieldValues().get( 1 )).getExpected() );
}