1 9 10 package org.netbeans.jmi.javamodel.codegen; 11 12 import java.lang.reflect.Modifier ; 13 import org.netbeans.jmi.javamodel.JavaClass; 14 import org.netbeans.jmi.javamodel.JavaModelPackage; 15 import org.netbeans.jmi.javamodel.Resource; 16 import org.netbeans.junit.NbTestCase; 17 import org.netbeans.junit.NbTestSuite; 18 19 23 public class DefaultTest extends NbTestCase { 24 25 26 public DefaultTest() { 27 super("DefaultTest"); 28 } 29 30 public static NbTestSuite suite() { 31 NbTestSuite suite = new NbTestSuite(DefaultTest.class); 32 return suite; 33 } 34 35 private JavaModelPackage pkg; 36 private JavaClass clazz1; 37 private JavaClass clazz2; 38 39 protected void setUp() { 40 clazz1 = Utility.findClass("AKlas"); 41 clazz2 = Utility.findClass("BKlas"); 42 pkg = (JavaModelPackage) clazz1.refImmediatePackage(); 43 } 44 45 public void testMoveBToA() throws Exception { 46 boolean fail = true; 47 Utility.beginTrans(true); 48 try { 49 System.err.println(clazz1); 50 System.err.println(clazz2); 51 Resource r = clazz2.getResource(); 52 r.getClassifiers().remove(clazz2); 53 int mods = clazz2.getModifiers(); 54 clazz2.setModifiers(mods | Modifier.STATIC); 55 clazz1.getContents().add(clazz2); 56 fail = false; 57 } finally { 58 Utility.endTrans(fail); 59 } 60 assertFile("File is not correctly generated.", 61 getGoldenFile("AKlas.pass"), 62 Utility.getFile(getDataDir(), "AKlas.java"), 63 getWorkDir() 64 ); 65 assertFile("File is not correctly generated.", 66 getGoldenFile("BKlas.pass"), 67 Utility.getFile(getDataDir(), "BKlas.java"), 68 getWorkDir() 69 ); 70 } 71 } 72 | Popular Tags |