}
public void testBasicNoOptimizerUsage() {
// test historic sequence behavior, where the initial values start at 1...
SourceMock sequence = new SourceMock( 1 );
Optimizer optimizer = OptimizerFactory.buildOptimizer( OptimizerFactory.NONE, Long.class, 1 );
for ( int i = 1; i < 11; i++ ) {
final Long next = ( Long ) optimizer.generate( sequence );
assertEquals( i, next.intValue() );
}
assertEquals( 10, sequence.getTimesCalled() );
assertEquals( 10, sequence.getCurrentValue() );
// test historic table behavior, where the initial values started at 0 (we now force 1 to be the first used id value)
sequence = new SourceMock( 0 );
optimizer = OptimizerFactory.buildOptimizer( OptimizerFactory.NONE, Long.class, 1 );
for ( int i = 1; i < 11; i++ ) {
final Long next = ( Long ) optimizer.generate( sequence );
assertEquals( i, next.intValue() );
}
assertEquals( 11, sequence.getTimesCalled() ); // an extra time to get to 1 initially
assertEquals( 10, sequence.getCurrentValue() );
}