Class LogCapturing

java.lang.Object
org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing
All Implemented Interfaces:
org.junit.rules.TestRule

public final class LogCapturing extends Object implements org.junit.rules.TestRule
JUnit TestRule to make log lines appear only when the test failed.

Use this in test by adding a public field annotated with @TestRule:


   @Rule public final LogCapturing logCapturing = new LogCapturing();
 

Requires Logback and configuration like the following the logback-test.xml:


     <appender name="CapturingAppender" class="org.apache.pekko.actor.testkit.typed.internal.CapturingAppender" />

     <logger name="org.apache.pekko.actor.testkit.typed.internal.CapturingAppenderDelegate" >
       <appender-ref ref="STDOUT"/>
     </logger>

     <root level="DEBUG">
         <appender-ref ref="CapturingAppender"/>
     </root>
 
  • Constructor Details

    • LogCapturing

      public LogCapturing()
  • Method Details

    • 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