Class TestRuleLimitSysouts

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class TestRuleLimitSysouts
    extends com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
    Fails the suite if it prints over the given limit of bytes to either System.out or System.err, unless the condition is not enforced (see isEnforced()).
    • Field Detail

      • DEFAULT_SYSOUT_BYTES_THRESHOLD

        public static final int DEFAULT_SYSOUT_BYTES_THRESHOLD
        Max limit of bytes printed to either System.out or System.err. This limit is enforced per-class (suite).
        See Also:
        Constant Field Values
    • Constructor Detail

    • Method Detail

      • before

        protected void before()
                       throws Throwable
        Overrides:
        before in class com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
        Throws:
        Throwable
      • checkCaptureStreams

        public static void checkCaptureStreams()
        Ensures System.out and System.err point to delegate streams.
      • isEnforced

        protected boolean isEnforced()
      • afterIfSuccessful

        protected void afterIfSuccessful()
                                  throws Throwable
        We're only interested in failing the suite if it was successful (otherwise just propagate the original problem and don't bother doing anything else).
        Overrides:
        afterIfSuccessful in class com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
        Throws:
        Throwable
      • afterAlways

        protected void afterAlways​(List<Throwable> errors)
                            throws Throwable
        Overrides:
        afterAlways in class com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
        Throws:
        Throwable