KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > java > sourceexception > FieldChanged


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * FieldChanged.java
22  *
23  * Created on June 26, 2000, 9:29 AM
24  */

25
26 package org.netbeans.test.java.sourceexception.FieldChanged;
27
28 //import org.openide.src.Type;
29
//import org.openide.src.Identifier;
30
//import org.openide.src.SourceException;
31
import java.lang.reflect.Modifier JavaDoc;
32 import org.openide.loaders.DataObject;
33
34
35 /**
36  * @author Jan Becicka <Jan.Becicka@sun.com>
37  */

38
39 public class FieldChanged extends org.netbeans.test.java.XRunner {
40
41     public static void main(java.lang.String JavaDoc[] args) {
42         junit.textui.TestRunner.run(suite());
43     }
44
45     public FieldChanged() {
46         super("");
47     }
48     
49     public FieldChanged(java.lang.String JavaDoc testName) {
50         super(testName);
51     }
52     
53     public static org.netbeans.junit.NbTest suite() {
54         return new org.netbeans.junit.NbTestSuite(FieldChanged.class);
55     }
56     
57     /** "body" of this TestCase
58      * @param o SourceElement - target for generating
59      * @param log log is used for logging StackTraces
60      * @throws Exception
61      * @return true if test passed
62      * false if failed
63      */

64     public boolean go(Object JavaDoc o, java.io.PrintWriter JavaDoc log) throws Exception JavaDoc {
65         
66 // org.openide.src.ClassElement clazz = ((org.openide.src.SourceElement) o).getClasses()[0];
67
// System.setProperty(org.netbeans.test.java.eventfiring.MyListener.RESULT_KEY,"");
68
boolean passed = true;
69         
70 // org.openide.src.FieldElement fe = org.netbeans.test.java.Common.createField("newField",Modifier.PUBLIC | Modifier.STATIC , Type.BOOLEAN);
71
// clazz.addField(fe);
72
// fe = clazz.getField(Identifier.create("newField"));
73
// clazz.removeField(fe);
74
//
75
// try {
76
// fe.setType(Type.FLOAT);
77
// } catch (SourceException e){
78
// ref("setType succesfully throws "+e);
79
// }
80
//
81
// try {
82
// fe.setInitValue("3");
83
// } catch (SourceException e){
84
// ref("setInitValue succesfully throws "+e);
85
// }
86
//
87
// try {
88
// fe.setModifiers(Modifier.PROTECTED);
89
// } catch (SourceException e){
90
// ref("setModifiers succesfully throws "+e);
91
// }
92
//
93
// try {
94
// fe.setName(Identifier.create("ranamedField"));
95
// } catch (SourceException e){
96
// ref("setName succesfully throws "+e);
97
// }
98
return passed;
99     }
100     
101     protected boolean writeResult(DataObject DO) {
102         return true;
103     }
104     
105     /**
106      */

107     protected void setUp() {
108         super.setUp();
109         name = "JavaTestSourceExceptionThrowingFieldChanged";
110         packageName = "org.netbeans.test.java.testsources";
111     }
112 }
113
Popular Tags