new int[][] {
{ 2 },
{ 2 },
{ 0 },
} );
MultiTermIndexIterator multiTermIndexIterator = (MultiTermIndexIterator)MultiTermIndexIterator.getInstance( i0, i1, i2 );
assertEquals( 3, multiTermIndexIterator.frequency() );
assertTrue( multiTermIndexIterator.hasNext() );
assertTrue( multiTermIndexIterator.hasNext() ); // To increase coverage
assertEquals( 0, multiTermIndexIterator.nextDocument() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() ); // To increase coverage
assertEquals( Interval.valueOf( 0 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( Interval.valueOf( 1 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() );
assertEquals( 4, multiTermIndexIterator.count() );
int[] position = multiTermIndexIterator.positionArray();
assertEquals( 0, position[ 0 ] );
assertEquals( 1, position[ 1 ] );
assertEquals( 2, position[ 2 ] );
assertEquals( 3, position[ 3 ] );
assertEquals( Interval.valueOf( 2 ), multiTermIndexIterator.intervalIterator().nextInterval() );
position = new int[ 4 ];
multiTermIndexIterator.positions( position );
assertEquals( 0, position[ 0 ] );
assertEquals( 1, position[ 1 ] );
assertEquals( 2, position[ 2 ] );
assertEquals( 3, position[ 3 ] );
assertEquals( Interval.valueOf( 3 ), multiTermIndexIterator.intervalIterator().nextInterval() );
IntIterator positions = multiTermIndexIterator.positions();
assertEquals( 0, positions.nextInt() );
assertEquals( 1, positions.nextInt() );
assertEquals( 2, positions.nextInt() );
assertEquals( 3, positions.nextInt() );
assertFalse( positions.hasNext() );
assertFalse( multiTermIndexIterator.intervalIterator().hasNext() );
assertFalse( multiTermIndexIterator.intervalIterator().hasNext() ); // To increase coverage
assertEquals( 1, multiTermIndexIterator.nextDocument() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() ); // To increase coverage
assertEquals( Interval.valueOf( 0 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( Interval.valueOf( 2 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( 2, multiTermIndexIterator.count() );
position = multiTermIndexIterator.positionArray();
assertEquals( 0, position[ 0 ] );
assertEquals( 2, position[ 1 ] );
positions = multiTermIndexIterator.positions();
assertEquals( 0, positions.nextInt() );
assertEquals( 2, positions.nextInt() );
assertFalse( positions.hasNext() );
assertFalse( multiTermIndexIterator.intervalIterator().hasNext() );
assertEquals( 2, multiTermIndexIterator.nextDocument() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() ); // To increase coverage
assertEquals( Interval.valueOf( 0 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( Interval.valueOf( 1 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( 2, multiTermIndexIterator.count() );
position = multiTermIndexIterator.positionArray();
assertEquals( 0, position[ 0 ] );
assertEquals( 1, position[ 1 ] );
positions = multiTermIndexIterator.positions();
assertEquals( 0, positions.nextInt() );
assertEquals( 1, positions.nextInt() );
assertFalse( positions.hasNext() );
assertFalse( multiTermIndexIterator.intervalIterator().hasNext() );
// Here we get the iterator of the underlying IndexIterator
assertEquals( 3, multiTermIndexIterator.nextDocument() );
assertTrue( multiTermIndexIterator.intervalIterator().hasNext() );
assertEquals( Interval.valueOf( 0 ), multiTermIndexIterator.intervalIterator().nextInterval() );
assertEquals( 1, multiTermIndexIterator.count() );
position = multiTermIndexIterator.positionArray();
assertEquals( 0, position[ 0 ] );
positions = multiTermIndexIterator.positions();
assertEquals( 0, positions.nextInt() );
assertFalse( positions.hasNext() );
assertFalse( multiTermIndexIterator.intervalIterator().hasNext() );
// The end
assertFalse( multiTermIndexIterator.hasNext() );
assertFalse( multiTermIndexIterator.hasNext() ); // To increase coverage
}