private static long getTimeoutInSeconds(Class<?> clazz) {
    Category[] categories = clazz.getAnnotationsByType(Category.class);
    // Starting JUnit 4.13, it appears that the timeout is applied across all the parameterized
    // runs. So the timeout is multiplied by number of parameterized runs.
    int numParams = getNumParameters(clazz);
    // @Category is not repeatable -- it is only possible to get an array of length zero or one.
    if (categories.length == 1) {
      for (Class<?> c : categories[0].value()) {
        if (UNIT_TEST_CLASSES.contains(c)) {
          long timeout = numParams * PER_UNIT_TEST_TIMEOUT_MINS;
          LOG.info("Test {} timeout: {} mins", clazz, timeout);
          return TimeUnit.MINUTES.toSeconds(timeout);
        }
        if (c == IntegrationTests.class) {
          return TimeUnit.MINUTES.toSeconds(Long.MAX_VALUE);
        }
      }
    }
    throw new IllegalArgumentException(
      clazz.getName() + " does not have SmallTests/MediumTests/LargeTests in @Category");
  }
Mainly used for {@link HBaseClassTestRuleChecker} to confirm that we use the correct class to
generate timeout ClassRule.
hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java