KickJava   Java API By Example, From Geeks To Geeks.

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


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  * ClassChanged.java
22  *
23  * Created on June 26, 2000, 9:29 AM
24  */

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

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

65     public boolean go(Object JavaDoc o, java.io.PrintWriter JavaDoc log) throws Exception JavaDoc {
66         
67 // ClassElement clazz = ((org.openide.src.SourceElement) o).getClasses()[0];
68
// System.setProperty(org.netbeans.test.java.eventfiring.MyListener.RESULT_KEY,"");
69
boolean passed = true;
70         
71 // ClassElement innerClass = new ClassElement();
72
// innerClass.setModifiers(Modifier.PUBLIC);
73
// innerClass.setSuperclass(Identifier.create("Obj"));
74
// innerClass.setName(Identifier.create("Inn","Inn"));
75
// clazz.addClass(innerClass);
76
//
77
// innerClass = clazz.getClasses()[0];
78
// clazz.removeClass(innerClass);
79
//
80
//
81
// try {
82
// innerClass.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
83
// } catch (SourceException e){
84
// ref("setModifiers succesfully throws "+e);
85
// }
86
//
87
// try {
88
// innerClass.setSuperclass(Identifier.create("Object"));
89
// } catch (SourceException e){
90
// ref("setSuperclass succesfully throws "+e);
91
// }
92
//
93
// try {
94
// innerClass.setName(Identifier.create("InnerClass","InnerClass"));
95
// } catch (SourceException e){
96
// ref("setName succesfully throws "+e);
97
// }
98
//
99
// try {
100
// innerClass.addMethod(Common.createMethod("method1", Modifier.PRIVATE | Modifier.SYNCHRONIZED, org.openide.src.Type.INT, Common.PARS2));
101
// } catch (SourceException e){
102
// ref("addMethod succesfully throws "+e);
103
// }
104
//
105
// try {
106
// innerClass.addField(Common.createField("field"));
107
// } catch (SourceException e){
108
// ref("addField succesfully throws "+e);
109
// }
110
//
111
// try {
112
// innerClass.addConstructor(Common.createConstructor(null,Common.PARS1));
113
// } catch (SourceException e){
114
// ref("addConstructor succesfully throws "+e);
115
// }
116
//
117
// try {
118
// innerClass.addClass(innerClass);
119
// } catch (SourceException e){
120
// ref("addClass succesfully throws "+e);
121
// }
122
//
123
// try {
124
// innerClass.addInitializer(Common.createInitializer());
125
// } catch (SourceException e){
126
// ref("addInitializer succesfully throws "+e);
127
// }
128
//
129
// try {
130
// innerClass.addInterface(Identifier.create("Iface"));
131
// } catch (SourceException e){
132
// ref("addInterface succesfully throws "+e);
133
// }
134

135         return passed;
136     }
137     
138     protected boolean writeResult(DataObject DO) {
139         return true;
140     }
141     
142     /**
143      */

144     protected void setUp() {
145         super.setUp();
146         name = "JavaTestSourceExceptionThrowingClassChanged";
147         packageName = "org.netbeans.test.java.testsources";
148     }
149     
150 }
151
Popular Tags