### Question:
PartitionedIndexStorage { public void prepareFolder( File folder ) throws IOException { cleanupFolder( folder ); fileSystem.mkdirs( folder ); } PartitionedIndexStorage( DirectoryFactory directoryFactory, FileSystemAbstraction fileSystem, File rootFolder ); Directory openDirectory( File folder ); File getPartitionFolder( int partition ); File getIndexFolder(); void reserveIndexFailureStorage(); void storeIndexFailure( String failure ); String getStoredIndexFailure(); void prepareFolder( File folder ); void cleanupFolder( File folder ); Map<File,Directory> openIndexDirectories(); List<File> listFolders();  }### Answer:
@Test void prepareFolderCreatesFolder() throws IOException { File folder = createRandomFolder( testDir.databaseDir() ); storage.prepareFolder( folder ); assertTrue( fs.fileExists( folder ) ); }
@Test void prepareFolderRemovesFromFileSystem() throws IOException { File folder = createRandomFolder( testDir.databaseDir() ); createRandomFilesAndFolders( folder ); storage.prepareFolder( folder ); assertTrue( fs.fileExists( folder ) ); assertTrue( ArrayUtil.isEmpty( fs.listFiles( folder ) ) ); }
@Test void prepareFolderRemovesFromLucene() throws IOException { File folder = createRandomFolder( testDir.databaseDir() ); Directory dir = createRandomLuceneDir( folder ); assertFalse( ArrayUtil.isEmpty( dir.listAll() ) ); storage.prepareFolder( folder ); assertTrue( fs.fileExists( folder ) ); assertTrue( ArrayUtil.isEmpty( dir.listAll() ) ); }