FileBasedFilesystemDirectory implements FilesystemDirectory { @Override public DirectoryLock lock() throws IOException { CloseLock lock = LOCK_MANAGER.lockOrFail(directory); return lock::close; } FileBasedFilesystemDirectory(Path directory); @Override DirectoryLock lock(); @Override FileData create(String filename, boolean canExist); @Override FileData getFileData(String filename); @Override void delete(String filename); @Override void backup(String filename);  }
@Test public void lock() throws Exception { filesystemDirectory.lock().close(); assertTrue(Files.exists(testPath.resolve("lock"))); }