SnapshotService { public void clearSnapshot(String snapshotName, Node host) throws ReaperException { clusterFacade.clearSnapshot(snapshotName, host); } private  SnapshotService(AppContext context, ExecutorService executor, Supplier<ClusterFacade> clusterFacadeSupplier); static SnapshotService create(AppContext context, ExecutorService executor); Pair<Node, String> takeSnapshot(String snapshotName, Node host, String... keyspaces); List<Pair<Node, String>> takeSnapshotClusterWide(
      String snapshotName,
      String clusterName,
      String owner,
      String cause,
      String... keyspace); Map<String, List<Snapshot>> listSnapshotsGroupedByName(Node host); List<Snapshot> listSnapshots(Node host); Map<String, Map<String, List<Snapshot>>> listSnapshotsClusterWide(String clusterName); void clearSnapshot(String snapshotName, Node host); void clearSnapshotClusterWide(String snapshotName, String clusterName); String formatSnapshotName(String snapshotName); static final String SNAPSHOT_PREFIX; }
@Test public void testClearSnapshot() throws InterruptedException, ReaperException, ClassNotFoundException, IOException { JmxProxy proxy = (JmxProxy) mock(Class.forName("io.cassandrareaper.jmx.JmxProxyImpl")); StorageServiceMBean storageMBean = Mockito.mock(StorageServiceMBean.class); JmxProxyTest.mockGetStorageServiceMBean(proxy, storageMBean); AppContext cxt = new AppContext(); cxt.config = TestRepairConfiguration.defaultConfig(); cxt.jmxConnectionFactory = mock(JmxConnectionFactory.class); when(cxt.jmxConnectionFactory.connectAny(any(Collection.class))).thenReturn(proxy); SnapshotService .create(cxt, SNAPSHOT_MANAGER_EXECUTOR) .clearSnapshot("test", Node.builder().withHostname("127.0.0.1").build()); verify(storageMBean, times(1)).clearSnapshot("test"); }