KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > java > source > gen > FieldTest3


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 package org.netbeans.api.java.source.gen;
20
21 import java.io.IOException JavaDoc;
22 import java.util.List JavaDoc;
23 import junit.textui.TestRunner;
24 import org.netbeans.junit.NbTestCase;
25 import org.netbeans.junit.NbTestSuite;
26 import org.openide.filesystems.FileStateInvalidException;
27
28 /**
29  * Tests more transaction on file with fields. Tests fields generating and
30  * also update.
31  *
32  * @author Pavel Flaska
33  */

34 public class FieldTest3 extends GeneratorTest {
35
36     /** Creates a new instance of FieldTest3 */
37     public FieldTest3(String JavaDoc name) {
38         super(name);
39     }
40     
41     public static NbTestSuite suite() {
42         NbTestSuite suite = new NbTestSuite(FieldTest3.class);
43         return suite;
44     }
45     
46     protected void setUp() throws Exception JavaDoc {
47         super.setUp();
48         testFile = getFile(getSourceDir(), getSourcePckg() + "FieldTest3.java");
49     }
50
51     /**
52      * Tests inital value for fields in field group.
53      */

54     public void testGroupInitValues() throws IOException JavaDoc {
55         System.err.println("testGroupInitValues");
56 /* FieldGroup group = (FieldGroup) clazz.getContents().get(2);
57             List fields = group.getFields();
58             ((Field) fields.get(0)).setInitialValueText("\"prvni\"");
59             ((Field) fields.get(2)).setInitialValueText("\"treti\"");*/

60         assertFiles("testGroupInitValues_FieldTest3.pass");
61     }
62     
63     /**
64      * Tests group separation
65      */

66     public void testGroupSeparation() throws IOException JavaDoc {
67         System.err.println("testGroupSeparation");
68   /* Field second = (Field) clazz.getFeatures().remove(3);
69             Field third = (Field) clazz.getFeatures().remove(3);
70             clazz.getFeatures().add(second);
71             clazz.getFeatures().add(third);*/

72         assertFiles("testGroupSeparation_FieldTest3.pass");
73     }
74     
75     /**
76      * @param args the command line arguments
77      */

78     public static void main(String JavaDoc[] args) {
79         TestRunner.run(suite());
80     }
81     
82     String JavaDoc getSourcePckg() {
83         return "org/netbeans/test/codegen/";
84     }
85
86     String JavaDoc getGoldenPckg() {
87         return "org/netbeans/jmi/javamodel/codegen/FieldTest3/";
88     }
89 }
90
Popular Tags