@Test(groups = "unit")
public void readSessionConsistency_SomeReplicasLagBehindAndReturningResponseWithLowerLSN_FindAnotherReplica() {

    long slowReplicaLSN = 651176;
    String partitionKeyRangeId = "1";
    long fasterReplicaLSN = 651177;
    List<Uri> secondaries = ImmutableList.of(Uri.create("secondary1"), Uri.create("secondary2"), Uri.create("secondary3"));
    Uri primaryAddress = Uri.create("primary");
    AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create()
            .withPrimary(primaryAddress)
            .withSecondary(secondaries)
            .build();
    StoreResponse primaryResponse = StoreResponseBuilder.create()
            .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN)
            .withLSN(slowReplicaLSN)
            .withLocalLSN(slowReplicaLSN)
            .withQuorumAckecdLsn(slowReplicaLSN)
            .withQuorumAckecdLocalLsn(slowReplicaLSN)
            .withGlobalCommittedLsn(-1)
            .withItemLocalLSN(slowReplicaLSN)
            .withRequestCharge(1.1)
            .build();
    StoreResponse secondaryResponse1 = StoreResponseBuilder.create()
            .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN)
            .withLSN(slowReplicaLSN)
            .withLocalLSN(slowReplicaLSN)
            .withQuorumAckecdLsn(slowReplicaLSN)
            .withQuorumAckecdLocalLsn(slowReplicaLSN)
            .withGlobalCommittedLsn(-1)
            .withItemLocalLSN(slowReplicaLSN)
            .withRequestCharge(1.1)
            .build();
    StoreResponse secondaryResponse2 = StoreResponseBuilder.create()
            .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN)
            .withLSN(fasterReplicaLSN)
            .withLocalLSN(fasterReplicaLSN)
            .withQuorumAckecdLsn(fasterReplicaLSN)
            .withQuorumAckecdLocalLsn(fasterReplicaLSN)
            .withGlobalCommittedLsn(-1)
            .withItemLocalLSN(fasterReplicaLSN)
            .withRequestCharge(1.1)
            .build();
    StoreResponse secondaryResponse3 = StoreResponseBuilder.create()
            .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN)
            .withLSN(slowReplicaLSN)
            .withLocalLSN(slowReplicaLSN)
            .withQuorumAckecdLsn(slowReplicaLSN)
            .withQuorumAckecdLocalLsn(slowReplicaLSN)
            .withGlobalCommittedLsn(-1)
            .withItemLocalLSN(slowReplicaLSN)
            .withRequestCharge(1.1)
            .build();
    TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder()
            .storeResponseOn(primaryAddress, OperationType.Read, ResourceType.Document, primaryResponse, true)
            .storeResponseOn(secondaries.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, true)
            .storeResponseOn(secondaries.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, true)
            .storeResponseOn(secondaries.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, true)
            .build();
    GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong);
    ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class);
    IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class);
    ConsistencyReaderUnderTest consistencyReader = new ConsistencyReaderUnderTest(addressSelectorWrapper.addressSelector,
                                                                                  sessionContainer,
                                                                                  transportClientWrapper.transportClient,
                                                                                  gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader,
                                                                                  authorizationTokenProvider);
    RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(
            OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document);
    request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name());
    request.requestContext = new DocumentServiceRequestContext();
    Utils.ValueHolder<ISessionToken> sessionToken = Utils.ValueHolder.initialize(null);
    assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue();
    request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class);
    request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId);
    request.requestContext.requestChargeTracker = new RequestChargeTracker();
    Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(request), Mockito.anyString());
    TimeoutHelper timeout = Mockito.mock(TimeoutHelper.class);
    boolean forceRefresh = false;
    boolean isInRetry = false;
    Single<StoreResponse> storeResponseSingle = consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh);
    StoreResponseValidator validator = StoreResponseValidator.create()
            .withBELSN(fasterReplicaLSN)
            .withRequestChargeGreaterThanOrEqualTo(1.1)
            .in(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3)
            .build();
    validateSuccess(storeResponseSingle, validator);
    Mockito.verifyZeroInteractions(consistencyReader.getSpyQuorumReader());
    Mockito.verify(consistencyReader.getSpyStoreReader(), Mockito.times(1))
            .readMultipleReplicaAsync(Mockito.any(RxDocumentServiceRequest.class),
                                      Mockito.anyBoolean(),
                                      Mockito.anyInt(),
                                      Mockito.anyBoolean(),
                                      Mockito.anyBoolean(),
                                      Mockito.any(),
                                      Mockito.anyBoolean(),
                                      Mockito.anyBoolean());
    assertThat(transportClientWrapper.validate()
            .getNumberOfInvocations())
            .isGreaterThanOrEqualTo(1)
            .isLessThanOrEqualTo(4);
    addressSelectorWrapper.validate()
            .verifyTotalInvocations(1)
            .verifyNumberOfForceCachRefresh(0)
            .verifyVesolvePrimaryUriAsyncCount(0)
            .verifyResolveAllUriAsync(1);
}