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

Groovy example source code file (MethodNodeTest.groovy)

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

acc_public, acc_public, blockstatement, blockstatement, methodnode, methodnode, methodnodetest, opcodes, opcodes, testcase

The Groovy MethodNodeTest.groovy source code

package org.codehaus.groovy.ast;

import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.objectweb.asm.Opcodes;

import junit.framework.TestCase;

/**
 * Tests the VariableExpressionNode
 * 
 * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf
 *
 */

public class MethodNodeTest extends TestCase implements Opcodes {

    public void testIsDynamicReturnTypeExplizitObject() {
        MethodNode methodNode = new MethodNode("foo", ACC_PUBLIC, new ClassNode(Object.class), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement());
        assertFalse(methodNode.isDynamicReturnType());
    }
    
    public void testIsDynamicReturnTypeDYNAMIC_TYPE() {
        MethodNode methodNode = new MethodNode("foo", ACC_PUBLIC, ClassHelper.DYNAMIC_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement());
        assertTrue(methodNode.isDynamicReturnType());
    }
    
    public void testIsDynamicReturnTypeVoid() {
        MethodNode methodNode = new MethodNode("foo", ACC_PUBLIC, ClassHelper.VOID_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement());
        assertFalse(methodNode.isDynamicReturnType());
    }
    
    public void testIsDynamicReturnTypNull() {
        MethodNode methodNode = new MethodNode("foo", ACC_PUBLIC, null, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement());
        assertFalse(methodNode.isDynamicReturnType());
        assertNotNull(methodNode.getReturnType());
    }
}

Other Groovy examples (source code examples)

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

new blog posts

 

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