Package at.willhaben.willtest.rule
Class LogContext
- java.lang.Object
-
- at.willhaben.willtest.rule.TestFailureAwareRule
-
- at.willhaben.willtest.rule.LogContext
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class LogContext extends TestFailureAwareRule
Sets log pattern variables to make it clear which log entry belongs to which test in case of parallel execution.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTEST_CLASSstatic java.lang.StringTEST_DISPLAY_NAMEstatic java.lang.StringTEST_METHODstatic java.lang.StringTHREAD_ID
-
Constructor Summary
Constructors Constructor Description LogContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafter(org.junit.runner.Description description, java.lang.Throwable testFailure)Called after all tests always.voidbefore(org.junit.runner.Description description)Can do something before a test.-
Methods inherited from class at.willhaben.willtest.rule.TestFailureAwareRule
apply, onError
-
-
-
-
Field Detail
-
TEST_CLASS
public static final java.lang.String TEST_CLASS
- See Also:
- Constant Field Values
-
TEST_DISPLAY_NAME
public static final java.lang.String TEST_DISPLAY_NAME
- See Also:
- Constant Field Values
-
TEST_METHOD
public static final java.lang.String TEST_METHOD
- See Also:
- Constant Field Values
-
THREAD_ID
public static final java.lang.String THREAD_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
before
public void before(org.junit.runner.Description description) throws java.lang.ThrowableDescription copied from class:TestFailureAwareRuleCan do something before a test. By default it does nothing.- Overrides:
beforein classTestFailureAwareRule- Parameters:
description- junit test description object- Throws:
java.lang.Throwable- any error from the test
-
after
public void after(org.junit.runner.Description description, java.lang.Throwable testFailure) throws java.lang.ThrowableDescription copied from class:TestFailureAwareRuleCalled after all tests always. By default it does nothing.- Overrides:
afterin classTestFailureAwareRule- Parameters:
description- junit test description objecttestFailure- in case of failed test it contains an exception. Otherwise null- Throws:
java.lang.Throwable- iftestFailureis null, it will fly, iftestFailureis not null, it will be added to that as suppressed exception. SeeThrowable.addSuppressed(Throwable)
-
-