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

Groovy example source code file (ValidNameTest.groovy)

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

groovytestcase, groovytestcase, temp, temp, validnametest, validnametest

The Groovy ValidNameTest.groovy source code

package groovy

class ValidNameTest extends GroovyTestCase {

    void testFieldNamesWithDollar() {
        def $foo$foo = '3foo'
        def foo$foo = '2foo'
        def $foo = '1foo'
        def foo = '0foo'
        assert $foo$foo == '3foo'
        assert foo$foo == '2foo'
        assert $foo == '1foo'
        assert foo == '0foo'
        assert "$foo$foo${foo$foo}${$foo$foo}${$foo}$foo" == '0foo0foo2foo3foo1foo0foo'
    }

    void testClassAndMethodNamesWithDollar() {
        assert new $Temp().$method() == 'bar'
    }
}

class $Temp {
    def $method() { 'bar' }
}

Other Groovy examples (source code examples)

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

new blog posts

 

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