### Question:
FastHdfsKeyValueDirectory extends Directory implements LastModified { @Override public String[] listAll() throws IOException { Set<String> fileNames = new HashSet<String>(_files.keySet()); return fileNames.toArray(new String[fileNames.size()]); } FastHdfsKeyValueDirectory(boolean readOnly, Timer hdfsKeyValueTimer, Configuration configuration, Path path);  FastHdfsKeyValueDirectory(boolean readOnly, Timer hdfsKeyValueTimer, Configuration configuration, Path path,
      long maxAmountAllowedPerFile, long maxOpenForWriting); void gc(); void writeBlock(String name, long blockId, byte[] b, int offset, int length); void readBlock(String name, long blockId, BytesRef ref); synchronized void writeLength(String name, long length); @Override IndexInput openInput(String name, IOContext context); @Override IndexOutput createOutput(final String name, IOContext context); @Override String[] listAll(); @Override boolean fileExists(String name); @Override void deleteFile(String name); @Override long fileLength(String name); @Override void sync(Collection<String> names); @Override void close(); @Override long getFileModified(String name);  }### Answer:
@SuppressWarnings("resource") @Test public void testOpenDirectoryAndReopenEmptyDirectory() throws IOException, InterruptedException { FastHdfsKeyValueDirectory directory1 = new FastHdfsKeyValueDirectory(false, _timer, _configuration, new Path(_path, "testOpenDirectoryAndReopenEmptyDirectory"), HdfsKeyValueStore.DEFAULT_MAX_AMOUNT_ALLOWED_PER_FILE, 5000L); assertTrue(Arrays.equals(new String[] {}, directory1.listAll())); FastHdfsKeyValueDirectory directory2 = new FastHdfsKeyValueDirectory(false, _timer, _configuration, new Path(_path, "testOpenDirectoryAndReopenEmptyDirectory")); assertTrue(Arrays.equals(new String[] {}, directory2.listAll())); }