Source Code Cross Referenced for JUnitSettingsTest.java in  » IDE-Netbeans » junit » org » netbeans » modules » junit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » junit » org.netbeans.modules.junit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 org.openide.*;
045:        import org.openide.options.SystemOption;
046:        import org.openide.util.HelpCtx;
047:        import org.openide.util.NbBundle;
048:        import java.io.*;
049:
050:        import junit.framework.*;
051:        import org.openide.*;
052:        import org.openide.options.SystemOption;
053:        import org.openide.util.HelpCtx;
054:        import org.openide.util.NbBundle;
055:        import org.openide.filesystems.FileSystem;
056:        import java.io.*;
057:        import java.util.Enumeration;
058:        import junit.framework.*;
059:        import org.netbeans.junit.*;
060:
061:        public class JUnitSettingsTest extends NbTestCase {
062:
063:            public JUnitSettingsTest(java.lang.String testName) {
064:                super (testName);
065:            }
066:
067:            public static void main(java.lang.String[] args) {
068:                junit.textui.TestRunner.run(suite());
069:            }
070:
071:            public static Test suite() {
072:                return new TestSuite(JUnitSettingsTest.class);
073:            }
074:
075:            /** Test of readExternal method, of class org.netbeans.modules.junit.JUnitSettings. */
076:            public void testReadExternal() {
077:                System.out.println("testReadExternal");
078:
079:                // this test is done togeter with test of writeExternal method
080:            }
081:
082:            /** Test of writeExternal method, of class org.netbeans.modules.junit.JUnitSettings. */
083:            public void testWriteExternal() throws Exception {
084:                System.out.println("testWriteExternal");
085:                JUnitSettings def1 = JUnitSettings.getDefault();
086:
087:                File fTmp = new File(System.getProperty("xdata")
088:                        + "/JUnitSettings/ser1.test");
089:                File fSer = new File(System.getProperty("xdata")
090:                        + "/JUnitSettings/ser1.pass");
091:                FileInputStream fis;
092:                ObjectInputStream ois;
093:                FileOutputStream fos;
094:                ObjectOutputStream oos;
095:
096:                // write settings
097:                fos = new FileOutputStream(fTmp);
098:                oos = new ObjectOutputStream(fos);
099:
100:                def1.setFileSystem(TST_FILE_SYSTEM_1);
101:                def1.setSuiteTemplate(TST_SUITE_TEMPLATE_1);
102:                def1.setClassTemplate(TST_CLASS_TEMPLATE_1);
103:                def1.setMembersPublic(false);
104:                def1.setMembersProtected(true);
105:                def1.setMembersPackage(false);
106:                def1.setBodyComments(true);
107:                def1.setBodyContent(false);
108:                def1.setJavaDoc(true);
109:                def1.setCfgCreateEnabled(false);
110:                def1.setCfgExecEnabled(true);
111:                def1.setExecutorType(JUnitSettings.EXECUTOR_DEBUGGER);
112:                def1.setGenerateExceptionClasses(false);
113:                def1.setTestRunner(TST_TEST_RUNNER_1);
114:                def1.setProperties(TST_PROPERTIES_1);
115:
116:                JUnitSettings.getDefault().writeExternal(oos);
117:                oos.close();
118:                assertFile(fTmp, fSer, new File(System.getProperty("xresults")));
119:
120:                // read settings
121:                fis = new FileInputStream(fSer);
122:                ois = new ObjectInputStream(fis);
123:
124:                JUnitSettings.getDefault().readExternal(ois);
125:                assertTrue(def1.getFileSystem().equals(TST_FILE_SYSTEM_1));
126:                assertTrue(def1.getSuiteTemplate().equals(TST_SUITE_TEMPLATE_1));
127:                assertTrue(def1.getClassTemplate().equals(TST_CLASS_TEMPLATE_1));
128:                assertTrue(false == def1.isMembersPublic());
129:                assertTrue(def1.isMembersProtected());
130:                assertTrue(false == def1.isMembersPackage());
131:                assertTrue(def1.isBodyComments());
132:                assertTrue(false == def1.isBodyContent());
133:                assertTrue(def1.isJavaDoc());
134:                assertTrue(false == def1.isCfgCreateEnabled());
135:                assertTrue(def1.isCfgExecEnabled());
136:                assertTrue(JUnitSettings.EXECUTOR_DEBUGGER == def1
137:                        .getExecutorType());
138:                assertTrue(false == def1.isGenerateExceptionClasses());
139:                assertEquals(def1.getTestRunner(), TST_TEST_RUNNER_1);
140:                assertEquals(def1.getProperties(), TST_PROPERTIES_1);
141:
142:                fTmp = new File(System.getProperty("xdata")
143:                        + "/JUnitSettings/ser2.test");
144:                fSer = new File(System.getProperty("xdata")
145:                        + "/JUnitSettings/ser2.pass");
146:
147:                // write settings
148:                fos = new FileOutputStream(fTmp);
149:                oos = new ObjectOutputStream(fos);
150:
151:                def1.setFileSystem(TST_FILE_SYSTEM_2);
152:                def1.setSuiteTemplate(TST_SUITE_TEMPLATE_2);
153:                def1.setClassTemplate(TST_CLASS_TEMPLATE_2);
154:                def1.setMembersPublic(true);
155:                def1.setMembersProtected(false);
156:                def1.setMembersPackage(true);
157:                def1.setBodyComments(false);
158:                def1.setBodyContent(true);
159:                def1.setJavaDoc(false);
160:                def1.setCfgCreateEnabled(true);
161:                def1.setCfgExecEnabled(false);
162:                def1.setExecutorType(JUnitSettings.EXECUTOR_INTERNAL);
163:                def1.setGenerateExceptionClasses(true);
164:                def1.setTestRunner(TST_TEST_RUNNER_2);
165:                def1.setProperties(TST_PROPERTIES_2);
166:
167:                JUnitSettings.getDefault().writeExternal(oos);
168:
169:                // read settings
170:                fis = new FileInputStream(fSer);
171:                ois = new ObjectInputStream(fis);
172:
173:                JUnitSettings.getDefault().readExternal(ois);
174:                assertTrue(def1.getFileSystem().equals(TST_FILE_SYSTEM_2));
175:                assertTrue(def1.getSuiteTemplate().equals(TST_SUITE_TEMPLATE_2));
176:                assertTrue(def1.getClassTemplate().equals(TST_CLASS_TEMPLATE_2));
177:                assertTrue(def1.isMembersPublic());
178:                assertTrue(false == def1.isMembersProtected());
179:                assertTrue(def1.isMembersPackage());
180:                assertTrue(false == def1.isBodyComments());
181:                assertTrue(def1.isBodyContent());
182:                assertTrue(false == def1.isJavaDoc());
183:                assertTrue(def1.isCfgCreateEnabled());
184:                assertTrue(false == def1.isCfgExecEnabled());
185:                assertTrue(JUnitSettings.EXECUTOR_INTERNAL == def1
186:                        .getExecutorType());
187:                assertTrue(def1.isGenerateExceptionClasses());
188:                assertEquals(def1.getTestRunner(), TST_TEST_RUNNER_2);
189:                assertEquals(def1.getProperties(), TST_PROPERTIES_2);
190:
191:                oos.close();
192:                assertFile(fTmp, fSer, new File(System.getProperty("xresults")));
193:            }
194:
195:            /** Test of displayName method, of class org.netbeans.modules.junit.JUnitSettings. */
196:            public void testDisplayName() {
197:                System.out.println("testDisplayName");
198:                assertTrue(null != JUnitSettings.getDefault().displayName());
199:            }
200:
201:            /** Test of getHelpCtx method, of class org.netbeans.modules.junit.JUnitSettings. */
202:            public void testGetHelpCtx() {
203:                System.out.println("testGetHelpCtx");
204:                // Add your test code here.
205:            }
206:
207:            /** Test of getDefault method, of class org.netbeans.modules.junit.JUnitSettings. */
208:            public void testGetDefault() {
209:                System.out.println("testGetDefault");
210:                JUnitSettings def1 = JUnitSettings.getDefault();
211:                JUnitSettings def2 = JUnitSettings.getDefault();
212:
213:                assertTrue(null != def1); // is it creatable
214:                assertTrue(def1 == def2); // as a singelton class
215:
216:                def1.initialize(); // force default values to be set
217:
218:                // test default values
219:                assertTrue(def1.getFileSystem().equals(""));
220:                assertTrue(def1.getSuiteTemplate().equals(
221:                        "Templates/JUnit/SimpleTest.java"));
222:                assertTrue(def1.getClassTemplate().equals(
223:                        "Templates/JUnit/SimpleTest.java"));
224:                assertTrue(def1.isMembersPublic());
225:                assertTrue(def1.isMembersProtected());
226:                assertTrue(def1.isMembersPackage());
227:                assertTrue(def1.isBodyComments());
228:                assertTrue(def1.isBodyContent());
229:                assertTrue(def1.isJavaDoc());
230:                assertTrue(def1.isCfgCreateEnabled());
231:                assertTrue(def1.isCfgExecEnabled());
232:                assertTrue(JUnitSettings.EXECUTOR_EXTERNAL == def1
233:                        .getExecutorType());
234:            }
235:
236:            /** Test of getFileSystem method, of class org.netbeans.modules.junit.JUnitSettings. */
237:            public void testGetFileSystem() {
238:                System.out.println("testGetFileSystem");
239:                JUnitSettings.getDefault().setFileSystem(TST_FILE_SYSTEM_1);
240:                assertTrue(JUnitSettings.getDefault().getFileSystem().equals(
241:                        TST_FILE_SYSTEM_1));
242:                JUnitSettings.getDefault().setFileSystem(TST_FILE_SYSTEM_2);
243:                assertTrue(JUnitSettings.getDefault().getFileSystem().equals(
244:                        TST_FILE_SYSTEM_2));
245:            }
246:
247:            /** Test of setFileSystem method, of class org.netbeans.modules.junit.JUnitSettings. */
248:            public void testSetFileSystem() {
249:                System.out.println("testSetFileSystem");
250:                // this test is done in test of getFileSystem
251:            }
252:
253:            /** Test of getSuiteTemplate method, of class org.netbeans.modules.junit.JUnitSettings. */
254:            public void testGetSuiteTemplate() {
255:                System.out.println("testGetSuiteTemplate");
256:                JUnitSettings.getDefault().setSuiteTemplate(
257:                        TST_SUITE_TEMPLATE_1);
258:                assertTrue(JUnitSettings.getDefault().getSuiteTemplate()
259:                        .equals(TST_SUITE_TEMPLATE_1));
260:                JUnitSettings.getDefault().setSuiteTemplate(
261:                        TST_SUITE_TEMPLATE_2);
262:                assertTrue(JUnitSettings.getDefault().getSuiteTemplate()
263:                        .equals(TST_SUITE_TEMPLATE_2));
264:            }
265:
266:            /** Test of setSuiteTemplate method, of class org.netbeans.modules.junit.JUnitSettings. */
267:            public void testSetSuiteTemplate() {
268:                System.out.println("testSetSuiteTemplate");
269:                // this test is done in test of getSuiteTemplate
270:            }
271:
272:            /** Test of getClassTemplate method, of class org.netbeans.modules.junit.JUnitSettings. */
273:            public void testGetClassTemplate() {
274:                System.out.println("testGetClassTemplate");
275:                JUnitSettings.getDefault().setClassTemplate(
276:                        TST_CLASS_TEMPLATE_1);
277:                assertTrue(JUnitSettings.getDefault().getClassTemplate()
278:                        .equals(TST_CLASS_TEMPLATE_1));
279:                JUnitSettings.getDefault().setClassTemplate(
280:                        TST_CLASS_TEMPLATE_2);
281:                assertTrue(JUnitSettings.getDefault().getClassTemplate()
282:                        .equals(TST_CLASS_TEMPLATE_2));
283:            }
284:
285:            /** Test of setClassTemplate method, of class org.netbeans.modules.junit.JUnitSettings. */
286:            public void testSetClassTemplate() {
287:                System.out.println("testSetClassTemplate");
288:                // this test is done in test of getCLassTemplate
289:            }
290:
291:            /** Test of isMembersPublic method, of class org.netbeans.modules.junit.JUnitSettings. */
292:            public void testIsMembersPublic() {
293:                System.out.println("testIsMembersPublic");
294:                JUnitSettings.getDefault().setMembersPublic(true);
295:                assertTrue(JUnitSettings.getDefault().isMembersPublic());
296:                JUnitSettings.getDefault().setMembersPublic(false);
297:                assertTrue(false == JUnitSettings.getDefault()
298:                        .isMembersPublic());
299:            }
300:
301:            /** Test of setMembersPublic method, of class org.netbeans.modules.junit.JUnitSettings. */
302:            public void testSetMembersPublic() {
303:                System.out.println("testSetMembersPublic");
304:                // this test is done in test of isMembersPublic
305:            }
306:
307:            /** Test of isMembersProtected method, of class org.netbeans.modules.junit.JUnitSettings. */
308:            public void testIsMembersProtected() {
309:                System.out.println("testIsMembersProtected");
310:                JUnitSettings.getDefault().setMembersProtected(true);
311:                assertTrue(JUnitSettings.getDefault().isMembersProtected());
312:                JUnitSettings.getDefault().setMembersProtected(false);
313:                assertTrue(false == JUnitSettings.getDefault()
314:                        .isMembersProtected());
315:            }
316:
317:            /** Test of setMembersProtected method, of class org.netbeans.modules.junit.JUnitSettings. */
318:            public void testSetMembersProtected() {
319:                System.out.println("testSetMembersProtected");
320:                // this test is done in test of isMembersProtected
321:            }
322:
323:            /** Test of isMembersPackage method, of class org.netbeans.modules.junit.JUnitSettings. */
324:            public void testIsMembersPackage() {
325:                System.out.println("testIsMembersPackage");
326:                JUnitSettings.getDefault().setMembersPackage(true);
327:                assertTrue(JUnitSettings.getDefault().isMembersPackage());
328:                JUnitSettings.getDefault().setMembersPackage(false);
329:                assertTrue(false == JUnitSettings.getDefault()
330:                        .isMembersPackage());
331:            }
332:
333:            /** Test of setMembersPackage method, of class org.netbeans.modules.junit.JUnitSettings. */
334:            public void testSetMembersPackage() {
335:                System.out.println("testSetMembersPackage");
336:                // this test is done in test of isMembersPackage
337:            }
338:
339:            /** Test of isBodyComments method, of class org.netbeans.modules.junit.JUnitSettings. */
340:            public void testIsBodyComments() {
341:                System.out.println("testIsBodyComments");
342:                JUnitSettings.getDefault().setBodyComments(true);
343:                assertTrue(JUnitSettings.getDefault().isBodyComments());
344:                JUnitSettings.getDefault().setBodyComments(false);
345:                assertTrue(false == JUnitSettings.getDefault().isBodyComments());
346:            }
347:
348:            /** Test of setBodyComments method, of class org.netbeans.modules.junit.JUnitSettings. */
349:            public void testSetBodyComments() {
350:                System.out.println("testSetBodyComments");
351:                // this test is done in test of isBodyComments
352:            }
353:
354:            /** Test of isBodyContent method, of class org.netbeans.modules.junit.JUnitSettings. */
355:            public void testIsBodyContent() {
356:                System.out.println("testIsBodyContent");
357:                JUnitSettings.getDefault().setBodyContent(true);
358:                assertTrue(JUnitSettings.getDefault().isBodyContent());
359:                JUnitSettings.getDefault().setBodyContent(false);
360:                assertTrue(false == JUnitSettings.getDefault().isBodyContent());
361:            }
362:
363:            /** Test of setBodyContent method, of class org.netbeans.modules.junit.JUnitSettings. */
364:            public void testSetBodyContent() {
365:                System.out.println("testSetBodyContent");
366:                // this test is done in test of isBodyContent
367:            }
368:
369:            /** Test of isJavaDoc method, of class org.netbeans.modules.junit.JUnitSettings. */
370:            public void testIsJavaDoc() {
371:                System.out.println("testIsJavaDoc");
372:                JUnitSettings.getDefault().setJavaDoc(true);
373:                assertTrue(JUnitSettings.getDefault().isJavaDoc());
374:                JUnitSettings.getDefault().setJavaDoc(false);
375:                assertTrue(false == JUnitSettings.getDefault().isJavaDoc());
376:            }
377:
378:            /** Test of setJavaDoc method, of class org.netbeans.modules.junit.JUnitSettings. */
379:            public void testSetJavaDoc() {
380:                System.out.println("testSetJavaDoc");
381:                // this test is done in test of isJavaDoc
382:            }
383:
384:            /** Test of isCfgCreateEnabled method, of class org.netbeans.modules.junit.JUnitSettings. */
385:            public void testIsCfgCreateEnabled() {
386:                System.out.println("testIsCfgCreateEnabled");
387:                JUnitSettings.getDefault().setCfgCreateEnabled(true);
388:                assertTrue(JUnitSettings.getDefault().isCfgCreateEnabled());
389:                JUnitSettings.getDefault().setCfgCreateEnabled(false);
390:                assertTrue(false == JUnitSettings.getDefault()
391:                        .isCfgCreateEnabled());
392:            }
393:
394:            /** Test of setCfgCreateEnabled method, of class org.netbeans.modules.junit.JUnitSettings. */
395:            public void testSetCfgCreateEnabled() {
396:                System.out.println("testSetCfgCreateEnabled");
397:                // this test is done in test of isCfgCreateEnabled
398:            }
399:
400:            /** Test of isCfgExecEnabled method, of class org.netbeans.modules.junit.JUnitSettings. */
401:            public void testIsCfgExecEnabled() {
402:                System.out.println("testIsCfgExecEnabled");
403:                JUnitSettings.getDefault().setCfgExecEnabled(true);
404:                assertTrue(JUnitSettings.getDefault().isCfgExecEnabled());
405:                JUnitSettings.getDefault().setCfgExecEnabled(false);
406:                assertTrue(false == JUnitSettings.getDefault()
407:                        .isCfgExecEnabled());
408:            }
409:
410:            /** Test of setCfgExecEnabled method, of class org.netbeans.modules.junit.JUnitSettings. */
411:            public void testSetCfgExecEnabled() {
412:                System.out.println("testSetCfgExecEnabled");
413:                // this test is done in test of isCfgExecEnabled
414:            }
415:
416:            /** Test of getExecutorType method, of class org.netbeans.modules.junit.JUnitSettings. */
417:            public void testGetExecutorType() {
418:                System.out.println("testGetExecutorType");
419:                JUnitSettings.getDefault().setExecutorType(
420:                        JUnitSettings.EXECUTOR_INTERNAL);
421:                assertTrue(JUnitSettings.EXECUTOR_INTERNAL == JUnitSettings
422:                        .getDefault().getExecutorType());
423:                JUnitSettings.getDefault().setExecutorType(
424:                        JUnitSettings.EXECUTOR_DEBUGGER);
425:                assertTrue(JUnitSettings.EXECUTOR_DEBUGGER == JUnitSettings
426:                        .getDefault().getExecutorType());
427:            }
428:
429:            /** Test of setExecutorType method, of class org.netbeans.modules.junit.JUnitSettings. */
430:            public void testSetExecutorType() {
431:                System.out.println("testSetExecutorType");
432:                // this test is done in test of getExecutorType
433:            }
434:
435:            /** Test of isGenerateExceptionClasses method, of class org.netbeans.modules.junit.JUnitSettings. */
436:            public void testIsGenerateExceptionClasses() {
437:                System.out.println("testIsGenerateExceptionClasses");
438:                JUnitSettings.getDefault().setGenerateExceptionClasses(true);
439:                assertTrue(JUnitSettings.getDefault()
440:                        .isGenerateExceptionClasses());
441:                JUnitSettings.getDefault().setGenerateExceptionClasses(false);
442:                assertTrue(false == JUnitSettings.getDefault()
443:                        .isGenerateExceptionClasses());
444:            }
445:
446:            /** Test of setGenerateExceptionClasses method, of class org.netbeans.modules.junit.JUnitSettings. */
447:            public void testSetGenerateExceptionClasses() {
448:                System.out.println("testSetGenerateExceptionClasses");
449:                // this test is done in test of isGenerateExceptionClasses
450:            }
451:
452:            /** Test of getTestRunner method, of class org.netbeans.modules.junit.JUnitSettings. */
453:            public void testGetTestRunner() {
454:                System.out.println("testGetTestRunner");
455:                JUnitSettings.getDefault().setTestRunner(TST_TEST_RUNNER_1);
456:                assertEquals(JUnitSettings.getDefault().getTestRunner(),
457:                        TST_TEST_RUNNER_1);
458:                JUnitSettings.getDefault().setTestRunner(TST_TEST_RUNNER_2);
459:                assertEquals(JUnitSettings.getDefault().getTestRunner(),
460:                        TST_TEST_RUNNER_2);
461:            }
462:
463:            /** Test of setTestRunner method, of class org.netbeans.modules.junit.JUnitSettings. */
464:            public void testSetTestRunner() {
465:                System.out.println("testSetTestRunner");
466:                // this test is done in test of getTestRunner
467:            }
468:
469:            /** Test of getProperties method, of class org.netbeans.modules.junit.JUnitSettings. */
470:            public void testGetProperties() {
471:                System.out.println("testGetProperties");
472:                JUnitSettings.getDefault().setProperties(TST_PROPERTIES_1);
473:                assertEquals(JUnitSettings.getDefault().getProperties(),
474:                        TST_PROPERTIES_1);
475:                JUnitSettings.getDefault().setProperties(TST_PROPERTIES_2);
476:                assertEquals(JUnitSettings.getDefault().getProperties(),
477:                        TST_PROPERTIES_2);
478:            }
479:
480:            /** Test of setProperties method, of class org.netbeans.modules.junit.JUnitSettings. */
481:            public void testSetProperties() {
482:                System.out.println("testSetProperties");
483:                // this test is done in test of getProperties
484:            }
485:
486:            /** Test of initialize method, of class org.netbeans.modules.junit.JUnitSettings. */
487:            public void testInitialize() {
488:                System.out.println("testInitialize");
489:                // this test is done in test of testGetDefault
490:            }
491:
492:            // protected members
493:            protected File dump = new File(System.getProperty("xdata")
494:                    + "/JUnitSettings/settings.dump");
495:
496:            protected void setUp() {
497:                FileOutputStream fos;
498:                ObjectOutputStream oos;
499:
500:                try {
501:                    // write settings
502:                    fos = new FileOutputStream(dump);
503:                    oos = new ObjectOutputStream(fos);
504:
505:                    JUnitSettings.getDefault().writeExternal(oos);
506:                    oos.close();
507:                } catch (IOException e) {
508:                    System.out.println("JUnitSettingsTest.setUp has failed "
509:                            + e.getMessage());
510:                }
511:            }
512:
513:            protected void tearDown() {
514:                FileInputStream fis;
515:                ObjectInputStream ois;
516:
517:                try {
518:                    // read settings
519:                    fis = new FileInputStream(dump);
520:                    ois = new ObjectInputStream(fis);
521:
522:                    JUnitSettings.getDefault().readExternal(ois);
523:                    ois.close();
524:                } catch (Exception e) {
525:                    System.out.println("JUnitSettingsTest.tearDown has failed "
526:                            + e.getMessage());
527:                }
528:            }
529:
530:            // private members
531:            private static final String TST_FILE_SYSTEM_1 = "MyTestFileSystem";
532:            private static final String TST_SUITE_TEMPLATE_1 = "My/Test.Suite\\Template 1";
533:            private static final String TST_CLASS_TEMPLATE_1 = "My/Test Class\\Template.1";
534:            private static final String TST_TEST_RUNNER_1 = "test.of.test.runner.property";
535:            private static final String TST_PROPERTIES_1 = "prop1=val1\nprop2=val2\n";
536:
537:            private static final String TST_FILE_SYSTEM_2 = "MyTestFileSystem";
538:            private static final String TST_SUITE_TEMPLATE_2 = "My/Test.Suite\\Template 1";
539:            private static final String TST_CLASS_TEMPLATE_2 = "My/Test Class\\Template.1";
540:            private static final String TST_TEST_RUNNER_2 = "test.of.test.runner.property";
541:            private static final String TST_PROPERTIES_2 = "# comment\n\n";
542:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.