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

Groovy example source code file (Groovy252_Bug.groovy)

This example Groovy source code file (Groovy252_Bug.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

groovy252_bug, groovy252_bug, groovytestcase, groovytestcase

The Groovy Groovy252_Bug.groovy source code

package groovy.bugs

/**
 * @version $Revision: 4996 $
 */
class Groovy252_Bug extends GroovyTestCase {
    
    def count = 0
    
    void testBug() {
        def value = f()
        assert value == null
        
        value = g()
        assert value == null
        
        value = h()
        assert value == null
    }
    
    
    def f() {
         if (count++ == 5)
            return null
         else
            return null
    } 
    
    def g() {
         ++count
         return null
    } 
    
    def h() {
         ++count
         return null
    } 
}

Other Groovy examples (source code examples)

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

new blog posts

 

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