GroovyLogTestCase (Groovy 5.0.7)

Package: groovy.test

## [Groovy] Class GroovyLogTestCase

- groovy.test.GroovyLogTestCase

-     class GroovyLogTestCase
      extends GroovyTestCase

  Helper class to spoof log entries as produced by calling arbitrary code. This allows non-intrusive testing of dependent objects without explicitly using Mock objects as long as those dependent objects do some proper logging. As a measure of last resort, it can be used on MetaClass to spoof it's log entries on 'invokeMethod'.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class GroovyTestCase` | `TEST_SCRIPT_NAME_PREFIX, log`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GroovyLogTestCase()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static String` | `stringLog(Level level, String qualifier, Closure yield)` Execute the given Closure with the according level for the Logger that is qualified by the qualifier and return the log output as a String.
    `` | `static Object` | `withLevel(Level level, String qualifier, Closure yield)` Execute the given Closure with the according level for the Logger that is qualified by the qualifier.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyTestCase` | `assertArrayEquals, assertContains, assertContains, assertEquals, assertEquals, assertEquals, assertInspect, assertLength, assertLength, assertLength, assertScript, assertToString, fixEOLs, getMethodName, getName, getTestClassName, notYetImplemented, notYetImplemented, shouldFail, shouldFail, shouldFail, shouldFail, shouldFailWithCause`

- - ### Constructor Detail

    - #### GroovyLogTestCase()

  - ### Method Detail

    - #### static String stringLog(Level level, String qualifier, Closure yield)

      Execute the given Closure with the according level for the Logger that is qualified by the qualifier and return the log output as a String. Qualifiers are usually package or class names. Existing log level and handlers are restored after execution.

    - #### static Object withLevel(Level level, String qualifier, Closure yield)

      Execute the given Closure with the according level for the Logger that is qualified by the qualifier. Qualifiers are usually package or class names. The log level is restored after execution.