@Before
 public void setUp() throws Exception {
   solrSetupStrategy =
       new SolrSetupStrategy(solrImpl, trackerOperation, solrClusterConfig, environment);
   when(solrImpl.getEnvironmentManager()).thenReturn(environmentManager);
   when(environmentManager.loadEnvironment(any(String.class))).thenReturn(environment);
 }
  @Test(expected = ClusterSetupException.class)
  public void testSetupClusterAlreadyExist() throws Exception {
    when(solrClusterConfig.getClusterName()).thenReturn("test");
    when(solrClusterConfig.getNumberOfNodes()).thenReturn(5);
    when(solrImpl.getCluster(anyString())).thenReturn(solrClusterConfig);

    solrSetupStrategy.setup();
  }
  @Test
  public void testSetup() throws Exception {
    when(solrClusterConfig.getClusterName()).thenReturn("test");
    when(solrClusterConfig.getNumberOfNodes()).thenReturn(1);
    Set<EnvironmentContainerHost> mySet = new HashSet<>();
    mySet.add(containerHost);
    mySet.add(containerHost);
    when(environment.getContainerHosts()).thenReturn(mySet);
    when(containerHost.getTemplateName()).thenReturn(SolrClusterConfig.TEMPLATE_NAME);
    when(containerHost.getId()).thenReturn(UUID.randomUUID().toString());
    when(solrImpl.getPluginDAO()).thenReturn(pluginDAO);

    solrSetupStrategy.setup();

    // assertions
    verify(trackerOperation).addLog("Saving cluster information to database...");
    assertNotNull(solrImpl.getPluginDAO());
    verify(trackerOperation).addLog("Cluster information saved to database");
  }