KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > junit > JUnitSettingsBeanInfoTest


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 package org.netbeans.modules.junit;
21
22 import java.util.Iterator JavaDoc;
23 import java.util.LinkedList JavaDoc;
24 import java.util.TreeSet JavaDoc;
25 import java.util.Enumeration JavaDoc;
26 import java.awt.Image JavaDoc;
27 import java.beans.*;
28 import org.openide.*;
29 import org.openide.filesystems.FileSystem;
30 import org.openide.filesystems.FileObject;
31 import org.openide.util.NbBundle;
32 import junit.framework.*;
33
34 public class JUnitSettingsBeanInfoTest extends TestCase {
35
36     public JUnitSettingsBeanInfoTest(java.lang.String JavaDoc testName) {
37         super(testName);
38     }
39
40     public static void main(java.lang.String JavaDoc[] args) {
41         junit.textui.TestRunner.run(suite());
42     }
43     
44     public static Test suite() {
45         TestSuite suite = new TestSuite(JUnitSettingsBeanInfoTest.class);
46         suite.addTest(BoolPropEdTest.suite());
47         suite.addTest(SortedListPropEdTest.suite());
48         suite.addTest(ExecutorPropEdTest.suite());
49         suite.addTest(FileSystemPropEdTest.suite());
50         
51         return suite;
52     }
53     
54     /** Test of getPropertyDescriptors method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo. */
55     public void testGetPropertyDescriptors() {
56         System.out.println("testGetPropertyDescriptors");
57         PropertyDescriptor d[] = jbi.getPropertyDescriptors();
58         assertTrue(null != d);
59     }
60     
61     /** Test of getIcon method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo. */
62     public void testGetIcon() {
63         System.out.println("testGetIcon");
64         Image JavaDoc i = jbi.getIcon(BeanInfo.ICON_COLOR_16x16);
65         assertTrue(null != i);
66     }
67     
68     public static class BoolPropEdTest extends TestCase {
69
70         public BoolPropEdTest(java.lang.String JavaDoc testName) {
71             super(testName);
72         }
73         
74         public static void main(java.lang.String JavaDoc[] args) {
75             junit.textui.TestRunner.run(suite());
76         }
77         
78         public static Test suite() {
79             TestSuite suite = new TestSuite(BoolPropEdTest.class);
80             
81             return suite;
82         }
83         
84         /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
85         public void testGetTags() {
86             System.out.println("testGetTags");
87             String JavaDoc tags[] = bped.getTags();
88             assertTrue(null != tags);
89             assertTrue(2 == tags.length);
90         }
91         
92         /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
93         public void testGetAsText() {
94             System.out.println("testGetAsText");
95             String JavaDoc s = bped.getAsText();
96             assertTrue(null != s);
97         }
98         
99         /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
100         public void testSetAsText() {
101             System.out.println("testSetAsText");
102             // remeber the value
103
String JavaDoc s = bped.getAsText();
104             String JavaDoc tags[] = bped.getTags();
105             if (0 < tags.length) {
106                 bped.setAsText(tags[0]);
107                 assertEquals(tags[0], bped.getAsText());
108                 if (1 < tags.length) {
109                     bped.setAsText(tags[1]);
110                     assertEquals(tags[1], bped.getAsText());
111                 }
112             }
113             bped.setAsText(s);
114         }
115         
116         // protected members
117
protected JUnitSettingsBeanInfo.BoolPropEd bped;
118         
119         protected void setUp() {
120             bped = new JUnitSettingsBeanInfo.BoolPropEd();
121         }
122     }
123     
124     public static class SortedListPropEdTest extends TestCase {
125
126         public SortedListPropEdTest(java.lang.String JavaDoc testName) {
127             super(testName);
128         }
129         
130         public static void main(java.lang.String JavaDoc[] args) {
131             junit.textui.TestRunner.run(suite());
132         }
133         
134         public static Test suite() {
135             TestSuite suite = new TestSuite(SortedListPropEdTest.class);
136             
137             return suite;
138         }
139         
140         /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
141         public void testGetTags() {
142             System.out.println("testGetTags");
143             String JavaDoc tags[] = ped.getTags();
144             assertTrue(null != tags);
145             assertTrue(2 == tags.length);
146         }
147         
148         /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
149         public void testGetAsText() {
150             System.out.println("testGetAsText");
151             String JavaDoc s = ped.getAsText();
152             assertTrue(null != s);
153         }
154         
155         /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
156         public void testSetAsText() {
157             System.out.println("testSetAsText");
158             // remeber the value
159
String JavaDoc s = ped.getAsText();
160             String JavaDoc tags[] = ped.getTags();
161             if (0 < tags.length) {
162                 ped.setAsText(tags[0]);
163                 assertEquals(tags[0], ped.getAsText());
164                 if (1 < tags.length) {
165                     ped.setAsText(tags[1]);
166                     assertEquals(tags[1], ped.getAsText());
167                 }
168             }
169             ped.setAsText(s);
170         }
171         
172         /** Test of put method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
173         public void testPut() {
174             System.out.println("testPut");
175             
176             // Add your test code below by replacing the default call to fail.
177
fail("The test case is empty.");
178         }
179
180         // protected members
181
JUnitSettingsBeanInfo.SortedListPropEd ped;
182         
183         protected void setUp() {
184             ped = new JUnitSettingsBeanInfo.SortedListPropEd();
185             ped.put("display3", "value3", JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST | JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT);
186             ped.put("display1", "value1", JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST);
187             ped.put("display2", "value2", JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT);
188         }
189     }
190     
191     public static class ExecutorPropEdTest extends TestCase {
192
193         public ExecutorPropEdTest(java.lang.String JavaDoc testName) {
194             super(testName);
195         }
196         
197         public static void main(java.lang.String JavaDoc[] args) {
198             junit.textui.TestRunner.run(suite());
199         }
200         
201         public static Test suite() {
202             TestSuite suite = new TestSuite(ExecutorPropEdTest.class);
203             
204             return suite;
205         }
206         
207         /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
208         public void testGetTags() {
209             System.out.println("testGetTags");
210             String JavaDoc tags[] = ped.getTags();
211             assertTrue(null != tags);
212             assertTrue(3 == tags.length);
213         }
214         
215         /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
216         public void testGetAsText() {
217             System.out.println("testGetAsText");
218             String JavaDoc s = ped.getAsText();
219             assertTrue(null != s);
220         }
221         
222         /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
223         public void testSetAsText() {
224             System.out.println("testSetAsText");
225             String JavaDoc s = ped.getAsText();
226             String JavaDoc tags[] = ped.getTags();
227             if (0 < tags.length) {
228                 ped.setAsText(tags[0]);
229                 assertEquals(tags[0], ped.getAsText());
230                 if (1 < tags.length) {
231                     ped.setAsText(tags[1]);
232                     assertEquals(tags[1], ped.getAsText());
233                 }
234             }
235             ped.setAsText(s);
236         }
237         
238         // protected members
239
protected JUnitSettingsBeanInfo.ExecutorPropEd ped;
240         
241         protected void setUp() {
242             ped = new JUnitSettingsBeanInfo.ExecutorPropEd();
243         }
244     }
245     
246     public static class FileSystemPropEdTest extends TestCase {
247
248         public FileSystemPropEdTest(java.lang.String JavaDoc testName) {
249             super(testName);
250         }
251         
252         public static void main(java.lang.String JavaDoc[] args) {
253             junit.textui.TestRunner.run(suite());
254         }
255         
256         public static Test suite() {
257             TestSuite suite = new TestSuite(FileSystemPropEdTest.class);
258             
259             return suite;
260         }
261         
262         public void testDummy() {
263             // there is nothing to test in this class
264
// this exists here just to avoid - suite empty - error message
265
}
266     }
267     
268     // protected members
269
JUnitSettingsBeanInfo jbi;
270     
271     protected void setUp() {
272         jbi = new JUnitSettingsBeanInfo();
273     }
274 }
275
Popular Tags