@Test(groups = "unit")
public void resolveAsync() throws Exception {

    GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver(httpClient, endpointManager, Protocol.Https, authorizationTokenProvider, collectionCache, routingMapProvider,
            userAgentContainer,
            serviceConfigReader, connectionPolicy);
    RxDocumentServiceRequest request;
    request = RxDocumentServiceRequest.createFromName(
            OperationType.Read,
            "dbs/db/colls/coll/docs/doc1",
            ResourceType.Document);
    Set<URL> urlsBeforeResolve = globalAddressResolver.addressCacheByEndpoint.keySet();
    assertThat(urlsBeforeResolve.size()).isEqualTo(5);
    assertThat(urlsBeforeResolve.contains(urlforRead3)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints
    assertThat(urlsBeforeResolve.contains(urlforRead2)).isTrue();
    URL testUrl = new URL("http://Test.com/");
    Mockito.when(endpointManager.resolveServiceEndpoint(Matchers.any(RxDocumentServiceRequest.class))).thenReturn(testUrl);
    globalAddressResolver.resolveAsync(request, true);
    Set<URL> urlsAfterResolve = globalAddressResolver.addressCacheByEndpoint.keySet();
    assertThat(urlsAfterResolve.size()).isEqualTo(5);
    assertThat(urlsAfterResolve.contains(urlforRead2)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints
    assertThat(urlsBeforeResolve.contains(testUrl)).isTrue();//New endpoint will be added in addressCacheByEndpoint
}