Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.6
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.lang
[Groovy] Class GroovyLogTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              groovy.util.GroovyTestCase
                  groovy.lang.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'.

Authors:
  Dierk Koenig

See Also:
  GroovyLogTestCaseTest

Field Summary

Fields inherited from class GroovyTestCase
TEST_SCRIPT_NAME_PREFIX, log

Method Summary
`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 def` | `withLevel(Level level, String qualifier, Closure yield)` Execute the given Closure with the according level for the Logger that is qualified by the qualifier.

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

Methods inherited from class TestCase
run, run, toString, getName, setName, countTestCases, runBare, format, fail, fail, assertNotNull, assertNotNull, assertTrue, assertTrue, assertFalse, assertFalse, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNull, assertNull, assertSame, assertSame, assertNotSame, assertNotSame, failSame, failNotSame, failNotEquals, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll

Methods inherited from class Assert
format, fail, fail, assertNotNull, assertNotNull, assertTrue, assertTrue, assertFalse, assertFalse, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNull, assertNull, assertSame, assertSame, assertNotSame, assertNotSame, failSame, failNotSame, failNotEquals, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Method Detail

### stringLog

    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.

### withLevel

    static def 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.

Copyright © 2003-2010 The Codehaus. All rights reserved.