Class 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.
    • Constructor Summary

      Constructors 
      Constructor Description
      LogContext()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void after​(org.junit.runner.Description description, java.lang.Throwable testFailure)
      Called after all tests always.
      void before​(org.junit.runner.Description description)
      Can do something before a test.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogContext

        public LogContext()
    • Method Detail

      • before

        public void before​(org.junit.runner.Description description)
                    throws java.lang.Throwable
        Description copied from class: TestFailureAwareRule
        Can do something before a test. By default it does nothing.
        Overrides:
        before in class TestFailureAwareRule
        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.Throwable
        Description copied from class: TestFailureAwareRule
        Called after all tests always. By default it does nothing.
        Overrides:
        after in class TestFailureAwareRule
        Parameters:
        description - junit test description object
        testFailure - in case of failed test it contains an exception. Otherwise null
        Throws:
        java.lang.Throwable - if testFailure is null, it will fly, if testFailure is not null, it will be added to that as suppressed exception. See Throwable.addSuppressed(Throwable)