alvinalexander.com | 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') {
            loggedMethod()
        }
        assertTrue result, result.contains('some log entry')
    }

    void testCombinedUsageForMetaClass(){
/*
        def result = withLevel(Level.FINER, 'groovy.lang.MetaClass') {
            stringLog(Level.FINER, 'methodCalls'){
                'hi'.toString()
            }
        }
        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:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.