@Test
  public void testSimpleDrainageOutOfQuota() {
    TestChargeable testChargeable1 = new TestChargeable(
        Arrays.asList(QuotaAction.DELAY, QuotaAction.DELAY, QuotaAction.ALLOW, QuotaAction.DELAY, QuotaAction.DELAY,
            QuotaAction.ALLOW), TEST_QUOTA_RESOURCE1, quotaMethod);
    doAnswer((Answer<Void>) invocation -> {
      List<RequestInfo> requestsToSend = (List<RequestInfo>) invocation.getArguments()[0];
      requestsToSend.add(new RequestInfo(HOST, PORT, SEND, REPLICA_ID, testChargeable1));
      return null;
    }).when(putManager).poll(requestsToSend, requestsToDrop);
    quotaAwareOperationController.pollForRequests(requestsToSend, requestsToDrop);
    assertEquals(1, quotaAwareOperationController.getRequestQueue(quotaMethod).size());
    assertEquals(1, quotaAwareOperationController.getRequestQueue(quotaMethod).get(TEST_QUOTA_RESOURCE1).size());
    assertEquals(1, quotaAwareOperationController.getOutOfQuotaResourcesInQueue());
    assertEquals(1, quotaAwareOperationController.getDelayedQuotaResourcesInQueue());
    testChargeable1.verifyCalls(2, 1);

    quotaAwareOperationController.pollForRequests(requestsToSend, requestsToDrop);
    assertEquals(1, quotaAwareOperationController.getRequestQueue(quotaMethod).size());
    assertEquals(1, quotaAwareOperationController.getRequestQueue(quotaMethod).get(TEST_QUOTA_RESOURCE1).size());
    assertEquals(1, quotaAwareOperationController.getOutOfQuotaResourcesInQueue());
    assertEquals(1, quotaAwareOperationController.getDelayedQuotaResourcesInQueue());
    testChargeable1.verifyCalls(5, 2);

    quotaAwareOperationController.pollForRequests(requestsToSend, requestsToDrop);
    assertEquals(0, quotaAwareOperationController.getRequestQueue(quotaMethod).size());
    assertEquals(0, quotaAwareOperationController.getOutOfQuotaResourcesInQueue());
    assertEquals(0, quotaAwareOperationController.getDelayedQuotaResourcesInQueue());
    testChargeable1.verifyCalls(6, 2);
  }
Constructor for {@link QuotaAwareOperationControllerTest}.
@param quotaMethod {@link QuotaMethod} to use for the test run.
ambry-router/src/test/java/com/github/ambry/router/QuotaAwareOperationControllerTest.java