@Test
public void provideMetadataTest() throws ConnectorException {

    ClusterName clusterName = new ClusterName(CLUSTER_NAME);
    MongoMetadataEngine spyMetadataEngine = PowerMockito.spy(MongoMetadataEngine.getInstance(connectionHandler));
    CatalogMetadata catalogMetadata1 = mock(CatalogMetadata.class);
    CatalogMetadata catalogMetadata2 = mock(CatalogMetadata.class);
    when(client.getDatabaseNames()).thenReturn(Arrays.asList(DB_NAME, DB_NAME_SEC));
    PowerMockito.doReturn(catalogMetadata1)
                    .doReturn(catalogMetadata2)
                    .when(spyMetadataEngine)
                    .provideCatalogMetadata(Matchers.any(CatalogName.class), Matchers.eq(clusterName),
                                    Matchers.eq(connection));
    List<CatalogMetadata> providedMetadata = spyMetadataEngine.provideMetadata(clusterName, connection);
    Assert.assertEquals(providedMetadata.size(), 2);
    Assert.assertEquals(providedMetadata.get(0), catalogMetadata1);
    Assert.assertEquals(providedMetadata.get(1), catalogMetadata2);
}