@Test
  public void testSwitchExceedThrottleQuota() throws IOException {
    String regionServer = QuotaTableUtil.QUOTA_REGION_SERVER_ROW_KEY;
    Admin admin = TEST_UTIL.getAdmin();

    try {
      admin.exceedThrottleQuotaSwitch(true);
      fail("should not come here, because can't enable exceed throttle quota "
        + "if there is no region server quota");
    } catch (IOException e) {
      LOG.warn("Expected exception", e);
    }

    admin.setQuota(QuotaSettingsFactory.throttleRegionServer(regionServer,
      ThrottleType.WRITE_NUMBER, 100, TimeUnit.SECONDS));
    try {
      admin.exceedThrottleQuotaSwitch(true);
      fail("should not come here, because can't enable exceed throttle quota "
        + "if there is no read region server quota");
    } catch (IOException e) {
      LOG.warn("Expected exception", e);
    }

    admin.setQuota(QuotaSettingsFactory.throttleRegionServer(regionServer, ThrottleType.READ_NUMBER,
      20, TimeUnit.MINUTES));
    try {
      admin.exceedThrottleQuotaSwitch(true);
      fail("should not come here, because can't enable exceed throttle quota "
        + "because not all region server quota are in seconds time unit");
    } catch (IOException e) {
      LOG.warn("Expected exception", e);
    }
    admin.setQuota(QuotaSettingsFactory.throttleRegionServer(regionServer, ThrottleType.READ_NUMBER,
      20, TimeUnit.SECONDS));

    assertFalse(admin.exceedThrottleQuotaSwitch(true));
    assertTrue(admin.exceedThrottleQuotaSwitch(true));
    assertTrue(admin.exceedThrottleQuotaSwitch(false));
    assertFalse(admin.exceedThrottleQuotaSwitch(false));
    assertEquals(2, admin.getQuota(new QuotaFilter()).size());
    admin.setQuota(QuotaSettingsFactory.unthrottleRegionServer(regionServer));
  }
minicluster tests that validate that quota entries are properly set in the quota table
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java