public static SnapshotDirectory temporary(@Nonnull File directory) throws IOException {
        return new TemporarySnapshotDirectory(directory);
    }
@Test
    void temporary() throws Exception {
        File folderRoot = temporaryFolder.toFile();
        File folder = new File(folderRoot, String.valueOf(UUID.randomUUID()));
        assertThat(folder.mkdirs()).isTrue();
        SnapshotDirectory tmpSnapshotDirectory = SnapshotDirectory.temporary(folder);
        // temporary snapshot directories should not return a handle, because they will be deleted.
        assertThat(tmpSnapshotDirectory.completeSnapshotAndGetHandle()).isNull();
        // check that the directory is deleted even after we called #completeSnapshotAndGetHandle.
        assertThat(tmpSnapshotDirectory.cleanup()).isTrue();
        assertThat(folder).doesNotExist();
    }