@Test
  public void testIsQuotaExceedAllowed() throws Exception {
    // 1. Test that quota exceed is allowed if fe usage is lesser than quota.
    assertTrue(AMBRY_QUOTA_ENFORCER.isQuotaExceedAllowed(
        QuotaTestUtils.createRestRequest(ACCOUNT, ACCOUNT.getAllContainers().iterator().next(), RestMethod.GET)));

    // 2. Test that quota exceed is not allowed if fe usage is greater than quota.
    QUOTA_SOURCE.setFeUsage(QUOTA_SOURCE.getFeQuota().getRcu(), QUOTA_SOURCE.getFeQuota().getWcu());
    assertFalse(AMBRY_QUOTA_ENFORCER.isQuotaExceedAllowed(
        QuotaTestUtils.createRestRequest(ACCOUNT, ACCOUNT.getAllContainers().iterator().next(), RestMethod.GET)));
    expectedHighQuotaCount++;
    assertEquals(expectedHighQuotaCount, QUOTA_METRICS.highSystemResourceUsageCount.getCount());


    // 3. Test that quota exceed allowed doesn't depend upon resource's quota usage.
    Map<String, CapacityUnit> usageMap = QUOTA_SOURCE.getAllQuotaUsage();
    Map<String, CapacityUnit> quotaMap = QUOTA_SOURCE.getAllQuota();
    String id = String.valueOf(ACCOUNT.getId());
    usageMap.put(id, new CapacityUnit(quotaMap.get(id).getRcu() + 1, quotaMap.get(id).getWcu() + 1));
    QUOTA_SOURCE.setFeUsage(0, 0);
    assertTrue(AMBRY_QUOTA_ENFORCER.isQuotaExceedAllowed(
        QuotaTestUtils.createRestRequest(ACCOUNT, ACCOUNT.getAllContainers().iterator().next(), RestMethod.GET)));

    // 4. Test that quota exceed is allowed in case of any error.
    QUOTA_SOURCE.throwException = true;
    QUOTA_SOURCE.setFeUsage(QUOTA_SOURCE.getFeQuota().getRcu(), QUOTA_SOURCE.getFeQuota().getWcu());
    try {
      assertTrue(AMBRY_QUOTA_ENFORCER.isQuotaExceedAllowed(
          QuotaTestUtils.createRestRequest(ACCOUNT, ACCOUNT.getAllContainers().iterator().next(), RestMethod.GET)));
      fail("QuotaException should be thrown.");
    } catch (QuotaException quotaException) {
      assertTrue(quotaException.isRetryable());
    }
    QUOTA_SOURCE.throwException = false;
  }
Run with both request throttling enabled, as well as disabled.
@return an array with both {@code false} and {@code true}.
ambry-quota/src/test/java/com/github/ambry/quota/capacityunit/AmbryCUQuotaEnforcerTest.java