### Question:
IdGeneratorImpl implements IdGenerator { @Override public synchronized void close() { idContainer.close( highId ); } IdGeneratorImpl( FileSystemAbstraction fs, File file, int grabSize, long max, boolean aggressiveReuse,
            IdType idType, LongSupplier highId ); @Override synchronized long nextId(); @Override synchronized IdRange nextIdBatch( int size ); @Override synchronized void setHighId( long id ); @Override synchronized long getHighId(); @Override synchronized long getHighestPossibleIdInUse(); @Override synchronized void freeId( long id ); @Override synchronized void close(); static void createGenerator( FileSystemAbstraction fs, File fileName, long highId,
                                        boolean throwIfFileExists ); static long readHighId( FileSystemAbstraction fileSystem, File file ); static long readDefragCount( FileSystemAbstraction fileSystem, File file ); @Override synchronized long getNumberOfIdsInUse(); @Override synchronized long getDefragCount(); @Override synchronized void delete(); @Override String toString(); static final long INTEGER_MINUS_ONE; }### Answer:
@Test public void constructorShouldCallHighIdSupplierOnNonExistingIdFile() { LongSupplier highId = mock( LongSupplier.class ); when( highId.getAsLong() ).thenReturn( 0L ); IdGeneratorImpl idGenerator = new IdGeneratorImpl( fsr.get(), file, 100, 100, false, IdType.NODE, highId ); verify( highId ).getAsLong(); idGenerator.close(); }
@Test public void constructorShouldNotCallHighIdSupplierOnCleanIdFile() { IdContainer.createEmptyIdFile( fsr.get(), file, 42, true ); LongSupplier highId = mock( LongSupplier.class ); IdGenerator idGenerator = new IdGeneratorImpl( fsr.get(), file, 100, 100, false, IdType.NODE, highId ); idGenerator.close(); verifyZeroInteractions( highId ); }