1 19 20 25 26 package org.netbeans.test.java.generating.FieldElem; 27 28 import java.util.EnumSet ; 29 import java.util.Iterator ; 30 import javax.lang.model.element.Modifier; 31 import org.netbeans.test.java.Common; 32 import org.netbeans.api.java.source.JavaSource; 33 import org.netbeans.junit.*; 34 import org.openide.filesystems.FileObject; 35 36 58 59 60 public class FieldElem extends org.netbeans.test.java.XRunner { 61 62 public static void main(java.lang.String [] args) { 63 junit.textui.TestRunner.run(suite()); 64 } 65 66 public FieldElem() { 67 super(""); 68 } 69 70 public FieldElem(java.lang.String testName) { 71 super(testName); 72 } 73 74 public static NbTest suite() { 75 return new NbTestSuite(FieldElem.class); 76 } 77 78 85 public boolean go(Object o, java.io.PrintWriter log) throws Exception { 86 87 FileObject fo = (FileObject) o; 88 JavaSource js = JavaSource.forFileObject(fo); 89 90 int i=1; 92 EnumSet <Modifier> set = EnumSet.of(Modifier.PUBLIC,Modifier.STATIC); 93 Common.addField(js,Common.getFieldName(i++), set, "boolean"); 94 95 set = EnumSet.of(Modifier.PRIVATE,Modifier.STATIC); 96 Common.addField(js,Common.getFieldName(i++), set, "int"); 97 98 set = EnumSet.of(Modifier.PROTECTED); 99 Common.addField(js,Common.getFieldName(i++), set, "boolean"); 100 101 set = EnumSet.of(Modifier.SYNCHRONIZED,Modifier.PUBLIC); 102 Common.addField(js,Common.getFieldName(i++), set, "float"); 103 104 set = EnumSet.of(Modifier.FINAL,Modifier.PUBLIC,Modifier.STATIC); 105 Common.addField(js,Common.getFieldName(i++), set, "String"); 106 return true; 107 } 108 109 111 protected void setUp() { 112 super.setUp(); 113 name = "JavaTestSourceFieldElem"; 114 packageName = "org.netbeans.test.java.testsources"; 115 } 116 } 117 | Popular Tags |