@Test(groups = "unit", dataProvider = "readPrimaryAsync_RetryOnGoneArgProvider")
public void readPrimaryAsync_RetryOnPrimaryReplicaMove(Exception firstExceptionFromTransport,
                                                       boolean performLocalRefreshOnGoneException,
                                                       boolean retryWithForceRefreshExpected,
                                                       FailureValidator failureFromSingle,
                                                       boolean expectedStoreResponseInStoredReadResult) {

    ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class);
    StoreResponse response = StoreResponseBuilder.create().build();
    TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.sequentialBuilder()
            .then(firstExceptionFromTransport)
            .then(response)
            .build();
    Uri primaryURIPriorToRefresh = Uri.create("stale");
    Uri primaryURIAfterRefresh = Uri.create("new");
    RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(
            OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document);
    request.requestContext.performLocalRefreshOnGoneException = performLocalRefreshOnGoneException;
    request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class);
    request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12");
    request.requestContext.requestChargeTracker = new RequestChargeTracker();
    AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.PrimaryReplicaMoveBuilder.create(Protocol.Https)
            .withPrimaryReplicaMove(primaryURIPriorToRefresh, primaryURIAfterRefresh).build();
    StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer);
    Single<StoreResult> readResult = storeReader.readPrimaryAsync(request, true, true);
    if (failureFromSingle == null) {
        StoreResultValidator validator;
        if (expectedStoreResponseInStoredReadResult) {
            validator = StoreResultValidator.create().withStoreResponse(StoreResponseValidator.create().isSameAs(response).build()).build();
        } else {
            validator = StoreResultValidator.create().withException(FailureValidator.builder().sameAs(firstExceptionFromTransport).build()).build();
        }
       validateSuccess(readResult, validator);
    } else {
        validateException(readResult, failureFromSingle);
    }
    int numberOfAttempts = 1 + (retryWithForceRefreshExpected ? 1: 0);
    transportClientWrapper.validate()
            .verifyNumberOfInvocations(numberOfAttempts);
    addressSelectorWrapper.validate()
            .verifyResolveAddressesAsync(0)
            .verifyResolveAllUriAsync(0)
            .verifyVesolvePrimaryUriAsyncCount(numberOfAttempts)
            .verifyNumberOfForceCachRefresh(retryWithForceRefreshExpected ? 1: 0);
}