### Question:
FreeIdKeeper implements Closeable { public void freeId( long id ) { freeIds.enqueue( id ); freeIdCount++; if ( freeIds.size() >= batchSize ) { long endPosition = flushFreeIds( ByteBuffer.allocate( batchSize * ID_ENTRY_SIZE ) ); if ( aggressiveMode ) { stackPosition = endPosition; } } } FreeIdKeeper( StoreChannel channel, int batchSize, boolean aggressiveMode ); void freeId( long id ); long getId(); long[] getIds( int numberOfIds ); long getCount(); @Override void close();  }### Answer:
@Test public void shouldOnlyOverflowWhenThresholdIsReached() throws Exception { StoreChannel channel = spy( fs.get().open( new File( "id.file" ), OpenMode.READ_WRITE ) ); int batchSize = 10; FreeIdKeeper keeper = getFreeIdKeeperAggressive( channel, batchSize ); reset( channel ); for ( int i = 0; i < batchSize - 1; i++ ) { keeper.freeId( i ); } verifyZeroInteractions( channel ); keeper.freeId( 10 ); verify( channel ).writeAll( any( ByteBuffer.class ) ); }