1 19 package org.netbeans.jmi.javamodel.codegen.Positions; 20 21 import java.lang.reflect.Modifier ; 22 import java.util.Iterator ; 23 import java.util.List ; 24 import org.netbeans.jmi.javamodel.*; 25 import org.netbeans.junit.NbTestSuite; 26 import junit.textui.TestRunner; 27 import org.netbeans.jmi.javamodel.Parameter; 28 import org.netbeans.jmi.javamodel.Type; 29 import org.netbeans.jmi.javamodel.codegen.CodegenTestCase; 30 import org.netbeans.jmi.javamodel.codegen.Utility; 31 32 37 public class InterfacePositionsTest extends CodegenTestCase { 38 39 40 public InterfacePositionsTest(String name) { 41 super(name, "InterfacePositionsTest"); 42 } 43 44 public static NbTestSuite suite() { 45 NbTestSuite suite = new NbTestSuite(InterfacePositionsTest.class); 46 return suite; 47 } 48 49 JavaClass clazz; 50 JavaModelPackage pkg; 51 String sourceText; 52 53 protected void setUp() { 54 clazz = Utility.findClass("org.netbeans.test.codegen.InterfacePositionTest"); 55 pkg = (JavaModelPackage) clazz.refImmediatePackage(); 56 sourceText = clazz.getResource().getSourceText(); 57 } 58 59 public void testName() { 60 Utility.beginTrans(false); 61 try { 62 int nameSO = clazz.getPartStartOffset(ElementPartKindEnum.NAME); 63 int nameEO = clazz.getPartEndOffset(ElementPartKindEnum.NAME); 64 assertEquals("Interface name does not match.", "InterfacePositionTest", sourceText.substring(nameSO, nameEO)); 65 } 66 finally { 67 Utility.endTrans(); 68 } 69 } 70 71 74 public static void main(String [] args) { 75 TestRunner.run(suite()); 76 } 77 } 78 | Popular Tags |