org.apache.lucene.util

## Class TestRuleLimitSysouts

- java.lang.Object
- - com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
  - - org.apache.lucene.util.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()`).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `TestRuleLimitSysouts.Limit` An annotation specifying the limit of bytes per class.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_SYSOUT_BYTES_THRESHOLD` Max limit of bytes printed to either `System.out` or `System.err`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestRuleLimitSysouts(TestRuleMarkFailure failureMarker)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterAlways(List<Throwable> errors)`
    `protected void` | `afterIfSuccessful()` 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).
    `protected void` | `before()`
    `static void` | `checkCaptureStreams()` Ensures `System.out` and `System.err` point to delegate streams.
    `protected boolean` | `isEnforced()`

    - ### Methods inherited from class com.carrotsearch.randomizedtesting.rules.TestRuleAdapter

      `apply`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### TestRuleLimitSysouts

          public TestRuleLimitSysouts(TestRuleMarkFailure failureMarker)

  - ### 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`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.