Class SystemOutRule

All Implemented Interfaces:
org.junit.rules.TestRule, Executable, TestResource, SystemStubTestRule, Output<OutputStream>

public class SystemOutRule extends SystemOut implements SystemStubTestRule
JUnit4 test rule that captures System.out during tests.
Since:
1.0.0
See Also:
  • Constructor Details

    • SystemOutRule

      public SystemOutRule(Output<? extends OutputStream> output)
      Construct with an alternative Output to use
      Parameters:
      output - the output to write system error to
    • SystemOutRule

      public SystemOutRule(OutputFactory<? extends OutputStream> outputFactory)
      Construct with a OutputFactory for creating output objects from the existing output
      Parameters:
      outputFactory - the factory to use
    • SystemOutRule

      public SystemOutRule()
      Default constructor, uses a TapStream to tap system out while the rule is active