KickJava   Java API By Example, From Geeks To Geeks.

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


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

25
26 package org.netbeans.test.java.sourceexception.MethodChanged;
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.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 MethodChanged 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 MethodChanged() {
47         super("");
48     }
49     
50     public MethodChanged(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(MethodChanged.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 // org.openide.src.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 // org.openide.src.MethodElement me = Common.createMethod("method1", Modifier.PUBLIC | Modifier.STATIC, Type.VOID, Common.PARS1);
72
//
73
// clazz.addMethod(me);
74
// me = clazz.getMethods()[0];
75
// clazz.removeMethod(me);
76
//
77
// try {
78
// me.setBody("//blah\n");
79
// } catch (SourceException e){
80
// ref("setBody succesfully throws "+e);
81
// }
82
//
83
// try {
84
// me.setExceptions(new Identifier[]{Identifier.create("java.lang.Exception","Exception")});
85
// } catch (SourceException e){
86
// ref("setExceptions succesfully throws "+e);
87
// }
88
//
89
// try {
90
// me.setModifiers(Modifier.PROTECTED);
91
// } catch (SourceException e){
92
// ref("setModifiers succesfully throws "+e);
93
// }
94
//
95
// try {
96
// me.setName(Identifier.create("ranamedMethod"));
97
// } catch (SourceException e){
98
// ref("setName succesfully throws "+e);
99
// }
100
//
101
// try {
102
// me.setParameters(Common.PARS2);
103
// } catch (SourceException e){
104
// ref("setParameters succesfully throws "+e);
105
// }
106
//
107
// try {
108
// me.setReturn(Type.CHAR);
109
// } catch (SourceException e){
110
// ref("setReturn succesfully throws "+e);
111
// }
112
return passed;
113     }
114     
115     protected boolean writeResult(DataObject DO) {
116         return true;
117     }
118     
119     /**
120      */

121     protected void setUp() {
122         super.setUp();
123         name = "JavaTestSourceExceptionThrowingMethodChanged";
124         packageName = "org.netbeans.test.java.testsources";
125     }
126 }
127
Popular Tags