### Question:
SnapshotDirectory { public static SnapshotDirectory temporary(@Nonnull Path directory) throws IOException { return new TemporarySnapshotDirectory(directory); } private  SnapshotDirectory(@Nonnull Path directory, @Nonnull FileSystem fileSystem); private  SnapshotDirectory(@Nonnull Path directory); @Nonnull Path getDirectory(); boolean mkdirs(); @Nonnull FileSystem getFileSystem(); boolean exists(); FileStatus[] listStatus(); boolean cleanup(); boolean isSnapshotCompleted(); @Nullable abstract DirectoryStateHandle completeSnapshotAndGetHandle(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static SnapshotDirectory temporary(@Nonnull Path directory); static SnapshotDirectory permanent(@Nonnull Path directory);  }### Answer:
@Test public void temporary() throws Exception { File folderRoot = temporaryFolder.getRoot(); File folder = new File(folderRoot, String.valueOf(UUID.randomUUID())); Assert.assertTrue(folder.mkdirs()); Path folderPath = new Path(folder.toURI()); SnapshotDirectory tmpSnapshotDirectory = SnapshotDirectory.temporary(folderPath); Assert.assertNull(tmpSnapshotDirectory.completeSnapshotAndGetHandle()); Assert.assertTrue(tmpSnapshotDirectory.cleanup()); Assert.assertFalse(folder.exists()); }