### Question:
BatchingIdSequence implements IdSequence { @Override public IdRange nextIdBatch( int size ) { while ( IdValidator.hasReservedIdInRange( nextId, nextId + size ) ) { nextId += size; } long startId = nextId; nextId += size; return new IdRange( EMPTY_LONG_ARRAY, startId, size ); } BatchingIdSequence();  BatchingIdSequence( long startId ); @Override long nextId(); @Override IdRange nextIdBatch( int size ); void reset(); void set( long nextId ); long peek();  }### Answer:
@Test public void shouldSkipReservedIdWhenGettingBatches() { int batchSize = 10; BatchingIdSequence idSequence = new BatchingIdSequence( IdGeneratorImpl.INTEGER_MINUS_ONE - batchSize - batchSize / 2 ); IdRange range1 = idSequence.nextIdBatch( batchSize ); IdRange range2 = idSequence.nextIdBatch( batchSize ); assertNoReservedId( range1 ); assertNoReservedId( range2 ); }