### Question:
AmbariSolrCloudClient { public List<String> listCollections() throws Exception { return new ListCollectionCommand(getRetryTimes(), getInterval()).run(this); } AmbariSolrCloudClient(AmbariSolrCloudClientBuilder builder); List<String> listCollections(); String createCollection(); String outputCollectionData(); void setClusterProp(); void createZnode(); boolean isZnodeExists(String znode); void setupKerberosPlugin(); void secureSolrZnode(); void secureZnode(); void unsecureZnode(); String uploadConfiguration(); String downloadConfiguration(); boolean configurationExists(); Collection<String> createShard(String shard); Collection<String> getShardNames(); Collection<String> getSolrHosts(); boolean removeAdminHandlerFromCollectionConfig(); boolean transferZnode(); boolean deleteZnode(); String getZkConnectString(); String getCollection(); String getConfigSet(); String getConfigDir(); int getShards(); int getReplication(); int getRetryTimes(); int getInterval(); CloudSolrClient getSolrCloudClient(); SolrZkClient getSolrZkClient(); int getMaxShardsPerNode(); String getRouterName(); String getRouterField(); boolean isImplicitRouting(); String getJaasFile(); String getSaslUsers(); String getZnode(); String getPropName(); String getPropValue(); boolean isSecure(); String getSecurityJsonLocation(); String getTransferMode(); String getCopySrc(); String getCopyDest(); String getOutput(); boolean isIncludeDocNumber();  }### Answer:
@Test public void testListCollections() throws Exception { NamedList<Object> namedList = new NamedList<>(); namedList.add("collections", Arrays.asList("collection1", "collection2")); expect(mockedSolrClient.request(anyObject(CollectionAdminRequest.class), anyString())).andReturn(namedList); replay(mockedSolrClient); List<String> result = underTest.listCollections(); assertTrue(result.contains("collection1")); assertTrue(result.contains("collection2")); assertEquals(2, result.size()); }
@Test(expected = AmbariSolrCloudClientException.class) public void testRetries() throws Exception { expect(mockedSolrClient.request(anyObject(CollectionAdminRequest.class), anyString())).andThrow(new RuntimeException("ex")).times(2); replay(mockedSolrClient); underTest.listCollections(); }