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

Groovy example source code file (CallInnerClassCtorTest.groovy)

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

callinnerclassctortest, callinnerclassctortest, groovytestcase, groovytestcase, guillaume, guillaume, meudon, meudon

The Groovy CallInnerClassCtorTest.groovy source code

package groovy

/**
 * Checks that it's possible to call inner classes constructor from groovy
 * @author Guillaume Laforge
 */
class CallInnerClassCtorTest extends GroovyTestCase {

    void testCallCtor() {
        def user = new groovy.OuterUser()
        user.name = "Guillaume"
        user.age = 27

        assert user.name == "Guillaume"
        assert user.age == 27
    }

    void testCallInnerCtor() {
        def address = new groovy.OuterUser.InnerAddress()
        address.city = "Meudon"
        address.zipcode = 92360

        assert address.city == "Meudon"
        assert address.zipcode == 92360
    }

    void testCallInnerInnerCtor() {
        def address = new groovy.OuterUser.InnerAddress.Street()
        address.name = "rue de la paix"
        address.number = 17

        assert address.name == "rue de la paix"
        assert address.number == 17
    }

}

Other Groovy examples (source code examples)

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

new blog posts

 

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