001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.junit;
043:
044: import java.util.Iterator;
045: import java.util.LinkedList;
046: import java.util.TreeSet;
047: import java.util.Enumeration;
048: import java.awt.Image;
049: import java.beans.*;
050: import org.openide.*;
051: import org.openide.filesystems.FileSystem;
052: import org.openide.filesystems.FileObject;
053: import org.openide.util.NbBundle;
054: import junit.framework.*;
055:
056: public class JUnitSettingsBeanInfoTest extends TestCase {
057:
058: public JUnitSettingsBeanInfoTest(java.lang.String testName) {
059: super (testName);
060: }
061:
062: public static void main(java.lang.String[] args) {
063: junit.textui.TestRunner.run(suite());
064: }
065:
066: public static Test suite() {
067: TestSuite suite = new TestSuite(JUnitSettingsBeanInfoTest.class);
068: suite.addTest(BoolPropEdTest.suite());
069: suite.addTest(SortedListPropEdTest.suite());
070: suite.addTest(ExecutorPropEdTest.suite());
071: suite.addTest(FileSystemPropEdTest.suite());
072:
073: return suite;
074: }
075:
076: /** Test of getPropertyDescriptors method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo. */
077: public void testGetPropertyDescriptors() {
078: System.out.println("testGetPropertyDescriptors");
079: PropertyDescriptor d[] = jbi.getPropertyDescriptors();
080: assertTrue(null != d);
081: }
082:
083: /** Test of getIcon method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo. */
084: public void testGetIcon() {
085: System.out.println("testGetIcon");
086: Image i = jbi.getIcon(BeanInfo.ICON_COLOR_16x16);
087: assertTrue(null != i);
088: }
089:
090: public static class BoolPropEdTest extends TestCase {
091:
092: public BoolPropEdTest(java.lang.String testName) {
093: super (testName);
094: }
095:
096: public static void main(java.lang.String[] args) {
097: junit.textui.TestRunner.run(suite());
098: }
099:
100: public static Test suite() {
101: TestSuite suite = new TestSuite(BoolPropEdTest.class);
102:
103: return suite;
104: }
105:
106: /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
107: public void testGetTags() {
108: System.out.println("testGetTags");
109: String tags[] = bped.getTags();
110: assertTrue(null != tags);
111: assertTrue(2 == tags.length);
112: }
113:
114: /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
115: public void testGetAsText() {
116: System.out.println("testGetAsText");
117: String s = bped.getAsText();
118: assertTrue(null != s);
119: }
120:
121: /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.BoolPropEd. */
122: public void testSetAsText() {
123: System.out.println("testSetAsText");
124: // remeber the value
125: String s = bped.getAsText();
126: String tags[] = bped.getTags();
127: if (0 < tags.length) {
128: bped.setAsText(tags[0]);
129: assertEquals(tags[0], bped.getAsText());
130: if (1 < tags.length) {
131: bped.setAsText(tags[1]);
132: assertEquals(tags[1], bped.getAsText());
133: }
134: }
135: bped.setAsText(s);
136: }
137:
138: // protected members
139: protected JUnitSettingsBeanInfo.BoolPropEd bped;
140:
141: protected void setUp() {
142: bped = new JUnitSettingsBeanInfo.BoolPropEd();
143: }
144: }
145:
146: public static class SortedListPropEdTest extends TestCase {
147:
148: public SortedListPropEdTest(java.lang.String testName) {
149: super (testName);
150: }
151:
152: public static void main(java.lang.String[] args) {
153: junit.textui.TestRunner.run(suite());
154: }
155:
156: public static Test suite() {
157: TestSuite suite = new TestSuite(SortedListPropEdTest.class);
158:
159: return suite;
160: }
161:
162: /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
163: public void testGetTags() {
164: System.out.println("testGetTags");
165: String tags[] = ped.getTags();
166: assertTrue(null != tags);
167: assertTrue(2 == tags.length);
168: }
169:
170: /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
171: public void testGetAsText() {
172: System.out.println("testGetAsText");
173: String s = ped.getAsText();
174: assertTrue(null != s);
175: }
176:
177: /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
178: public void testSetAsText() {
179: System.out.println("testSetAsText");
180: // remeber the value
181: String s = ped.getAsText();
182: String tags[] = ped.getTags();
183: if (0 < tags.length) {
184: ped.setAsText(tags[0]);
185: assertEquals(tags[0], ped.getAsText());
186: if (1 < tags.length) {
187: ped.setAsText(tags[1]);
188: assertEquals(tags[1], ped.getAsText());
189: }
190: }
191: ped.setAsText(s);
192: }
193:
194: /** Test of put method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.SortedListPropEd. */
195: public void testPut() {
196: System.out.println("testPut");
197:
198: // Add your test code below by replacing the default call to fail.
199: fail("The test case is empty.");
200: }
201:
202: // protected members
203: JUnitSettingsBeanInfo.SortedListPropEd ped;
204:
205: protected void setUp() {
206: ped = new JUnitSettingsBeanInfo.SortedListPropEd();
207: ped
208: .put(
209: "display3",
210: "value3",
211: JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST
212: | JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT);
213: ped
214: .put(
215: "display1",
216: "value1",
217: JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST);
218: ped.put("display2", "value2",
219: JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT);
220: }
221: }
222:
223: public static class ExecutorPropEdTest extends TestCase {
224:
225: public ExecutorPropEdTest(java.lang.String testName) {
226: super (testName);
227: }
228:
229: public static void main(java.lang.String[] args) {
230: junit.textui.TestRunner.run(suite());
231: }
232:
233: public static Test suite() {
234: TestSuite suite = new TestSuite(ExecutorPropEdTest.class);
235:
236: return suite;
237: }
238:
239: /** Test of getTags method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
240: public void testGetTags() {
241: System.out.println("testGetTags");
242: String tags[] = ped.getTags();
243: assertTrue(null != tags);
244: assertTrue(3 == tags.length);
245: }
246:
247: /** Test of getAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
248: public void testGetAsText() {
249: System.out.println("testGetAsText");
250: String s = ped.getAsText();
251: assertTrue(null != s);
252: }
253:
254: /** Test of setAsText method, of class org.netbeans.modules.junit.JUnitSettingsBeanInfo.ExecutorPropEd. */
255: public void testSetAsText() {
256: System.out.println("testSetAsText");
257: String s = ped.getAsText();
258: String tags[] = ped.getTags();
259: if (0 < tags.length) {
260: ped.setAsText(tags[0]);
261: assertEquals(tags[0], ped.getAsText());
262: if (1 < tags.length) {
263: ped.setAsText(tags[1]);
264: assertEquals(tags[1], ped.getAsText());
265: }
266: }
267: ped.setAsText(s);
268: }
269:
270: // protected members
271: protected JUnitSettingsBeanInfo.ExecutorPropEd ped;
272:
273: protected void setUp() {
274: ped = new JUnitSettingsBeanInfo.ExecutorPropEd();
275: }
276: }
277:
278: public static class FileSystemPropEdTest extends TestCase {
279:
280: public FileSystemPropEdTest(java.lang.String testName) {
281: super (testName);
282: }
283:
284: public static void main(java.lang.String[] args) {
285: junit.textui.TestRunner.run(suite());
286: }
287:
288: public static Test suite() {
289: TestSuite suite = new TestSuite(FileSystemPropEdTest.class);
290:
291: return suite;
292: }
293:
294: public void testDummy() {
295: // there is nothing to test in this class
296: // this exists here just to avoid - suite empty - error message
297: }
298: }
299:
300: // protected members
301: JUnitSettingsBeanInfo jbi;
302:
303: protected void setUp() {
304: jbi = new JUnitSettingsBeanInfo();
305: }
306: }
|