Package org.apache.hadoop.hbase
Class HBaseClassTestRule
java.lang.Object
org.apache.hadoop.hbase.HBaseClassTestRule
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionprivate final Class<?>
private static final org.slf4j.Logger
private static long
private final SystemExitRule
private final org.junit.rules.Timeout
-
Constructor Summary
ModifierConstructorDescriptionprivate
HBaseClassTestRule
(Class<?> clazz, org.junit.rules.Timeout timeout) -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) static HBaseClassTestRule
Class<?>
getClazz()
Mainly used forHBaseClassTestRuleChecker
to confirm that we use the correct class to generate timeout ClassRule.(package private) static int
getNumParameters
(Class<?> clazz) private static long
getTimeoutInSeconds
(Class<?> clazz) private static boolean
isParametersMethod
(Method method) Helper method that checks if the input method is a valid JUnit @Parameters method.
-
Field Details
-
LOG
-
UNIT_TEST_CLASSES
-
PER_UNIT_TEST_TIMEOUT_MINS
-
clazz
-
timeout
-
systemExitRule
-
-
Constructor Details
-
HBaseClassTestRule
-
-
Method Details
-
getClazz
Mainly used forHBaseClassTestRuleChecker
to confirm that we use the correct class to generate timeout ClassRule. -
getTimeoutInSeconds
-
getNumParameters
- 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
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
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-