KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > java > generating > SourceGenerator


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

25
26 package org.netbeans.test.java.generating.SourceGenerator;
27 /** <B>Java Module General API Test: SourceGenerator</B>
28  * <BR><BR><I>What it tests:</I><BR>
29  * This test is more complex and checks adding Elements (especially order of adding).
30  * Test is focused on checking of correctness of generated code.
31  * <BR><BR><I>How it works:</I><BR>
32  * New class is created using DataObject.createFromTemplate().
33  * Then all possible Elements are added.
34  * These actions cause generating of .java code. This code is compared with supposed one.
35  * <BR><BR><I>Output:</I><BR>
36  * Generated Java code.
37  * <BR><BR><I>Possible reasons of failure:</I><BR>
38  * <BR><BR><U>Elements are added into bad positions or even not at all</U><BR>
39  * See .diff file to get which ones
40  * <BR><BR><U>Bad indentation</U><BR>
41  * This is probably not a bug of Java Module. (Editor Bug)
42  * In .diff file could be some whitespaces.
43  * <BR><BR><I>Exception occured:</I><BR>
44  * See .out file for StackTrace
45  *
46  *
47  * @author Jan Becicka <Jan.Becicka@sun.com>
48  */

49
50
51 public class SourceGenerator extends org.netbeans.test.java.XRunner {
52     
53     public static void main(java.lang.String JavaDoc[] args) {
54         junit.textui.TestRunner.run(suite());
55     }
56     
57     public SourceGenerator() {
58         super("");
59     }
60     
61     public SourceGenerator(java.lang.String JavaDoc testName) {
62         super(testName);
63     }
64     
65     public static org.netbeans.junit.NbTest suite() {
66         return new org.netbeans.junit.NbTestSuite(SourceGenerator.class);
67     }
68     
69     /** "body" of this TestCase
70      * @param o SourceElement - target for generating
71      * @param log log is used for logging StackTraces
72      * @throws Exception
73      * @return true if test passed
74      * false if failed
75      */

76     public boolean go(Object JavaDoc o, java.io.PrintWriter JavaDoc log) throws Exception JavaDoc {
77 // org.openide.src.ClassElement clazz = ((org.openide.src.SourceElement) o).getClasses()[0];
78
// org.netbeans.test.java.Common.simpleJavaSourceEtalonGenerator(clazz);
79
return true;
80     }
81     
82     /**
83      */

84     protected void setUp() {
85         super.setUp();
86         name = "JavaTestSourceSourceGenerator";
87         packageName = "org.netbeans.test.java.testsources";
88     }
89     
90 }
91
Popular Tags