final Cheese stilton2 = new Cheese( "stilton",
59 );
final InternalFactHandle h2 = new DefaultFactHandle( 2,
stilton2 );
RightTuple h1RightTuple = new RightTuple( h1, null );
RightTuple h2RightTuple = new RightTuple( h2, null );
// test add
index.add( h1RightTuple );
index.add( h2RightTuple );
assertEquals( h2,
index.first.getFactHandle() );
assertEquals( h1,
((RightTuple) index.first.getNext()).getFactHandle() );
// test get
assertEquals( h1,
index.get( h1 ).getFactHandle() );
assertEquals( h2,
index.get( h2 ).getFactHandle() );
// test removal for combinations
// remove first
index.remove( h2RightTuple );
assertEquals( h1RightTuple.getFactHandle(),
index.first.getFactHandle() );
// remove second
index.add( h2RightTuple );
index.remove( h1RightTuple );
assertEquals( h2RightTuple.getFactHandle(),
index.first.getFactHandle() );
// check index type does not change, as this fact is removed
stilton1.setType( "cheddar" );
}