.build(); String response = c.executeRequest(Http.GET(c.getBaseUri()).setNumberOfRetries(5)) .responseAsString(); assertTrue(response.isEmpty(), "There should be no response body on the mock response");
/** * Test that the outer number of configured retries takes precedence. * * @throws Exception */ @TestTemplate public void test429BackoffMaxMoreThanRetriesAllowed() throws Exception { // Always respond 429 for this test mockWebServer.setDispatcher(MockWebServerResources.ALL_429); try { CloudantClient c = CloudantClientHelper.newMockWebServerClientBuilder(mockWebServer) .interceptors(new Replay429Interceptor(10, 1, true)) .build(); String response = c.executeRequest(Http.GET(c.getBaseUri()).setNumberOfRetries(3)) .responseAsString(); fail("There should be a TooManyRequestsException instead had response " + response); } catch (TooManyRequestsException e) { assertEquals(3, mockWebServer .getRequestCount(), "There should be 3 request attempts"); } }