@Test
public void testTakeSnapshotClusterWide()
    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);
  ClusterFacade clusterFacadeSpy = Mockito.spy(ClusterFacade.create(cxt));
  Mockito.doReturn(Arrays.asList("127.0.0.1", "127.0.0.2", "127.0.0.3")).when(clusterFacadeSpy).getLiveNodes(any());
  Mockito.doReturn(Arrays.asList("127.0.0.1", "127.0.0.2", "127.0.0.3"))
      .when(clusterFacadeSpy)
      .getLiveNodes(any(), any());
  cxt.storage = mock(IStorage.class);
  Cluster cluster = Cluster.builder()
      .withName("testCluster")
      .withPartitioner("murmur3")
      .withSeedHosts(ImmutableSet.of("127.0.0.1"))
      .build();
  when(cxt.storage.getCluster(anyString())).thenReturn(cluster);
  List<Pair<Node,String>> result = SnapshotService
      .create(cxt, SNAPSHOT_MANAGER_EXECUTOR, () -> clusterFacadeSpy)
      .takeSnapshotClusterWide("snapshot", "testCluster", "testOwner", "testCause");
  Assertions.assertThat(result.size()).isEqualTo(3);
  for (int i = 0 ; i < 3 ; ++i) {
    Assertions.assertThat(result.get(i).getLeft().getClusterName()).isEqualTo("testcluster");
    Assertions.assertThat(result.get(i).getLeft().getHostname()).isEqualTo("127.0.0." + (i + 1));
    Assertions.assertThat(result.get(i).getRight()).isEqualTo("snapshot");
  }
  verify(storageMBean, times(3)).takeSnapshot("snapshot");
}