|
@Test
public void testAddItemRhsAtSpecificPosition() {
final RuleModel model = new RuleModel();
final ActionSetField a = new ActionSetField();
model.addRhsItem( a );
assertEquals( 1,
model.rhs.length );
final ActionSetField b = new ActionSetField();
model.addRhsItem( b );
assertEquals( 2,
model.rhs.length );
final ActionSetField c = new ActionSetField();
model.addRhsItem( c,
true );
assertEquals( 3,
model.rhs.length );
assertEquals( a,
model.rhs[0] );
assertEquals( b,
model.rhs[1] );
assertEquals( c,
model.rhs[2] );
final ActionSetField d = new ActionSetField();
model.addRhsItem( d,
false );
assertEquals( 4,
model.rhs.length );
assertEquals( d,
model.rhs[0] );
assertEquals( a,
model.rhs[1] );
assertEquals( b,
model.rhs[2] );
assertEquals( c,
model.rhs[3] );
final ActionSetField e = new ActionSetField();
model.addRhsItem( e,
2 );
assertEquals( 5,
model.rhs.length );
assertEquals( d,
model.rhs[0] );
assertEquals( a,
model.rhs[1] );
assertEquals( e,
model.rhs[2] );
assertEquals( b,
model.rhs[3] );
assertEquals( c,
model.rhs[4] );
//test auto-bound
final ActionSetField f = new ActionSetField();
final ActionSetField g = new ActionSetField();
model.addRhsItem( f,
-1 );
model.addRhsItem( g,
100 );
|