// first, as a control, make sure there are no results
int size = s.createQuery( query ).setString( "desc", "root%" ).list().size();
assertEquals( 0, size );
// now get the scrollable results
ScrollableResults results = s.createQuery( query ).setString( "desc", "root%" ).scroll();
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.next() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.previous() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
results.beforeFirst();
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.next() );
assertFalse( results.first() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.next() );
results.afterLast();
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.next() );
assertFalse( results.last() );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.next() );
for ( int i=1; i<3; i++ ) {
assertFalse( results.scroll( i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.scroll( - i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.setRowNumber( i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
assertFalse( results.setRowNumber( - i ) );
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
}
txn.commit();
s.close();
}