FileBasedTransientSnapshot implements TransientSnapshot { @Override public void abort() { try { LOGGER.debug("DELETE dir {}", directory); FileUtil.deleteFolder(directory); } catch (final IOException e) { LOGGER.warn("Failed to delete pending snapshot {}", this, e); } } FileBasedTransientSnapshot(
      final FileBasedSnapshotMetadata metadata,
      final Path directory,
      final FileBasedSnapshotStore snapshotStore); @Override boolean take(final Predicate<Path> takeSnapshot); @Override void abort(); @Override PersistedSnapshot persist(); Path getPath(); @Override String toString();  }
@Test public void shouldBeAbleToAbortNotStartedSnapshot() { final var index = 1L; final var term = 0L; final var transientSnapshot = persistedSnapshotStore.newTransientSnapshot(index, term, 1, 0); transientSnapshot.orElseThrow().abort(); assertThat(snapshotsDir.toFile().listFiles()).isEmpty(); assertThat(pendingSnapshotsDir.toFile().listFiles()).isEmpty(); }