Class HBaseClassTestRule

java.lang.Object
org.apache.hadoop.hbase.HBaseClassTestRule
All Implemented Interfaces:
org.junit.rules.TestRule

@Private public final class HBaseClassTestRule extends Object implements org.junit.rules.TestRule
The class level TestRule for all the tests. Every test class should have a ClassRule with it.

For now it only sets a test method timeout based off the test categories small, medium, large. Based on junit Timeout TestRule; see https://github.com/junit-team/junit/wiki/Rules

  • Field Details

  • Constructor Details

  • Method Details

    • getClazz

      public Class<?> getClazz()
      Mainly used for HBaseClassTestRuleChecker to confirm that we use the correct class to generate timeout ClassRule.
    • getTimeoutInSeconds

      private static long getTimeoutInSeconds(Class<?> clazz)
    • getNumParameters

      static int getNumParameters(Class<?> clazz)
      Parameters:
      clazz - Test class that is running.
      Returns:
      the number of parameters for this given test class. If the test is not parameterized or if there is any issue determining the number of parameters, returns 1.
    • isParametersMethod

      private static boolean isParametersMethod(@NonNull Method method)
      Helper method that checks if the input method is a valid JUnit @Parameters method.
      Parameters:
      method - Input method.
      Returns:
      true if the method is a valid JUnit parameters method, false otherwise.
    • forClass

      public static HBaseClassTestRule forClass(Class<?> clazz)
    • apply

      public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
      Specified by:
      apply in interface org.junit.rules.TestRule