home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (GroovyLogTestCaseTest.groovy)

This example Groovy source code file (GroovyLogTestCaseTest.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

groovylogtestcase, groovylogtestcase, groovylogtestcasetest, groovylogtestcasetest, log, log, logging

The Groovy GroovyLogTestCaseTest.groovy source code

package groovy.lang

import java.util.logging.Level
import java.util.logging.Logger

Showing usage of the GroovyLogTestCase
@author Dierk Koenig

class GroovyLogTestCaseTest extends GroovyLogTestCase {

    static final LOG = Logger.getLogger('groovy.lang.GroovyLogTestCaseTest')

    void loggedMethod() {
        LOG.finer 'some log entry'

    void testStringLog(){
        def result = stringLog(Level.FINER, 'groovy.lang.GroovyLogTestCaseTest') {
        assertTrue result, result.contains('some log entry')

    void testCombinedUsageForMetaClass(){
        def result = withLevel(Level.FINER, 'groovy.lang.MetaClass') {
            stringLog(Level.FINER, 'methodCalls'){
        assertTrue result, result.contains('java.lang.String toString()')

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy GroovyLogTestCaseTest.groovy source code file:

new blog posts


Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.