Source:
<code>private void assertOperationFailure(RouterErrorCode errorCode) throws RouterException, IOException, InterruptedException { NonBlockingRouter.currentOperationsCount.incrementAndGet(); GetBlobInfoOperation op = new GetBlobInfoOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, blobIdStr, options, null, routerCallback, kms, cryptoService, cryptoJobHandler, time); ArrayList<RequestInfo> requestListToFill = new ArrayList<>(); requestRegistrationCallback.requestListToFill = requestListToFill; op.poll(requestRegistrationCallback); Assert.assertEquals("There should only be as many requests at this point as requestParallelism", requestParallelism, correlationIdToGetOperation.size()); List<ResponseInfo> responses = sendAndWaitForResponses(requestListToFill); for (ResponseInfo responseInfo : responses) { GetResponse getResponse = responseInfo.getError() == null ? GetResponse.readFrom( new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse())), mockClusterMap) : null; op.handleResponse(responseInfo, getResponse); if (op.isOperationComplete()) { break; } } <START> int timeout = 500; <END> int timeSoFar = 0; while (timeSoFar < timeout && !op.isOperationComplete()) { op.poll(requestRegistrationCallback); Thread.sleep(10); timeSoFar += 10; } Assert.assertTrue("Operation should be complete at this time", op.isOperationComplete()); RouterException routerException = (RouterException) op.getOperationException(); Assert.assertEquals(errorCode, routerException.getErrorCode()); }</code><technical_language>this loop potentially moved a helper method in a couple places. Do iterations this runs for? I this hard do in a deterministic</technical_language>

Target:
private void assertOperationFailure(RouterErrorCode errorCode) throws RouterException, IOException, InterruptedException { NonBlockingRouter.currentOperationsCount.incrementAndGet(); GetBlobInfoOperation op = new GetBlobInfoOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, blobIdStr, options, null, routerCallback, kms, cryptoService, cryptoJobHandler, time); ArrayList<RequestInfo> requestListToFill = new ArrayList<>(); requestRegistrationCallback.requestListToFill = requestListToFill; op.poll(requestRegistrationCallback); Assert.assertEquals("There should only be as many requests at this point as requestParallelism", requestParallelism, correlationIdToGetOperation.size()); CountDownLatch onPollLatch = new CountDownLatch(1); routerCallback.setOnPollLatch(onPollLatch); List<ResponseInfo> responses = sendAndWaitForResponses(requestListToFill); for (ResponseInfo responseInfo : responses) { GetResponse getResponse = responseInfo.getError() == null ? GetResponse.readFrom( new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse())), mockClusterMap) : null; op.handleResponse(responseInfo, getResponse); if (op.isOperationComplete()) { break; } } if (!op.isOperationComplete()) { Assert.assertTrue("Latch should have been zeroed ", onPollLatch.await(500, TimeUnit.MILLISECONDS)); op.poll(requestRegistrationCallback); } Assert.assertTrue("Operation should be complete at this time", op.isOperationComplete()); RouterException routerException = (RouterException) op.getOperationException(); Assert.assertEquals(errorCode, routerException.getErrorCode()); }