@Test(groups = { "unit" }, timeOut = TIMEOUT)

public void shouldRetryWithInvalidPartitionException() {
    RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document);
    GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30);
    Single<IRetryPolicy.ShouldRetryResult> singleShouldRetry = goneAndRetryWithRetryPolicy
            .shouldRetry(new InvalidPartitionException());
    IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value();
    assertThat(shouldRetryResult.shouldRetry).isTrue();
    assertThat(request.requestContext.quorumSelectedLSN).isEqualTo(-1);
    assertThat(request.requestContext.resolvedPartitionKeyRange).isNull();
    assertThat(request.requestContext.globalCommittedSelectedLSN).isEqualTo(-1);
    assertThat(shouldRetryResult.policyArg.getValue0()).isFalse();
    goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException());
    // It will retry max till 3 attempts
    shouldRetryResult = goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException()).toBlocking()
            .value();
    assertThat(shouldRetryResult.shouldRetry).isFalse();
    DocumentClientException clientException = (DocumentClientException) shouldRetryResult.exception;
    assertThat(clientException.getStatusCode()).isEqualTo(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE);
}