1 46 package org.codehaus.groovy.ast; 47 48 import org.objectweb.asm.Constants; 49 50 import junit.framework.TestCase; 51 52 58 public class ClassNodeTest extends TestCase implements Constants { 59 60 ClassNode classNode = new ClassNode("Foo", ACC_PUBLIC, "java.lang.Object"); 61 ClassNode innerClassNode = new InnerClassNode(classNode, "Foo$1", ACC_PUBLIC, "java.lang.Object"); 62 63 protected void setUp() throws Exception { 64 classNode.addField("field", ACC_PUBLIC, "java.lang.String", null); 65 } 66 67 public void testOuterClass() { 68 assertNull(classNode.getOuterClass()); 69 assertNotNull(innerClassNode.getOuterClass()); 70 } 71 72 public void testOuterField() { 73 assertNull(classNode.getOuterField("field")); 74 assertNotNull(innerClassNode.getOuterField("field")); 75 } 76 77 public void testPackageName() { 78 assertEquals("Package", null, classNode.getPackageName()); 79 80 ClassNode packageNode = new ClassNode("com.acme.Foo", ACC_PUBLIC, "java.lang.Object"); 81 assertEquals("Package", "com.acme", packageNode.getPackageName()); 82 } 83 } 84 | Popular Tags |