Source Code Cross Referenced for IntegrationTestCaseUTest.java in  » Test-Coverage » GroboUtils » net » sourceforge » groboutils » junit » v1 » 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 » Test Coverage » GroboUtils » net.sourceforge.groboutils.junit.v1 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)IntegrationTestCaseUTest.java
003:         *
004:         * Copyright (C) 2002-2004 Matt Albrecht
005:         * groboclown@users.sourceforge.net
006:         * http://groboutils.sourceforge.net
007:         *
008:         *  Permission is hereby granted, free of charge, to any person obtaining a
009:         *  copy of this software and associated documentation files (the "Software"),
010:         *  to deal in the Software without restriction, including without limitation
011:         *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
012:         *  and/or sell copies of the Software, and to permit persons to whom the 
013:         *  Software is furnished to do so, subject to the following conditions:
014:         *
015:         *  The above copyright notice and this permission notice shall be included in 
016:         *  all copies or substantial portions of the Software. 
017:         *
018:         *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
019:         *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
020:         *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
021:         *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
022:         *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
023:         *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
024:         *  DEALINGS IN THE SOFTWARE.
025:         */
026:
027:        package net.sourceforge.groboutils.junit.v1;
028:
029:        //import net.sourceforge.groboutils.testing.junitlog.v1.*;
030:        import junit.framework.Test;
031:        import junit.framework.TestCase;
032:        import junit.framework.TestSuite;
033:        import junit.framework.TestResult;
034:        import junit.framework.TestFailure;
035:
036:        import java.util.Enumeration;
037:        import java.io.IOException;
038:        import java.lang.reflect.Method;
039:
040:        /**
041:         * Tests the IntegrationTestCase class.
042:         *
043:         * @author    Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
044:         * @since     March 1, 2002
045:         * @version   $Date: 2004/01/09 20:32:26 $
046:         */
047:        public class IntegrationTestCaseUTest extends TestCase {
048:            //-------------------------------------------------------------------------
049:            // Standard JUnit Class-specific declarations
050:
051:            private static final Class THIS_CLASS = IntegrationTestCaseUTest.class;
052:            private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
053:                    .getLogger(THIS_CLASS);
054:
055:            public IntegrationTestCaseUTest(String name) {
056:                super (name);
057:            }
058:
059:            //-------------------------------------------------------------------------
060:            // Tests
061:
062:            private static final String MSG = "#$%-=!";
063:
064:            public void testSoftAssert1() {
065:                IntegrationTestCase itc = createIntegrationTestCase();
066:
067:                // ensure that adding a failing test doesn't cause failures in the
068:                // owning test.
069:                itc.softFail();
070:            }
071:
072:            public void testSoftAssert2() {
073:                IntegrationTestCase itc = createIntegrationTestCase();
074:
075:                // ensure that adding a passing test doesn't cause failures in owning
076:                // test.
077:                itc.softAssertTrue(true);
078:            }
079:
080:            //---------
081:            public static class ITC_True1 extends IntegrationTestCase {
082:                public ITC_True1(String name) {
083:                    super (name);
084:                }
085:
086:                public void test1() {
087:                    softAssertTrue(true);
088:                }
089:            }
090:
091:            public void testSoftAssertTrue1() {
092:                // Ensure that two tests run, and there is one failure.
093:                runITC(ITC_True1.class, 2, 0, 0, false);
094:            }
095:
096:            //---------
097:            public static class ITC_True2 extends IntegrationTestCase {
098:                public ITC_True2(String name) {
099:                    super (name);
100:                }
101:
102:                public void test1() {
103:                    softAssertTrue(MSG, true);
104:                }
105:            }
106:
107:            public void testSoftAssertTrue2() {
108:                // Ensure that two tests run, and there is one failure.
109:                runITC(ITC_True2.class, 2, 0, 0, true);
110:            }
111:
112:            //---------
113:            public static class ITC_True3 extends IntegrationTestCase {
114:                public ITC_True3(String name) {
115:                    super (name);
116:                }
117:
118:                public void test1() {
119:                    softAssertTrue(false);
120:                }
121:            }
122:
123:            public void testSoftAssertTrue3() {
124:                // Ensure that two tests run, and there is one failure.
125:                runITC(ITC_True3.class, 2, 1, 0, false);
126:            }
127:
128:            //---------
129:            public static class ITC_True4 extends IntegrationTestCase {
130:                public ITC_True4(String name) {
131:                    super (name);
132:                }
133:
134:                public void test1() {
135:                    softAssertTrue(MSG, false);
136:                }
137:            }
138:
139:            public void testSoftAssertTrue4() {
140:                // Ensure that two tests run, and there is one failure.
141:                runITC(ITC_True4.class, 2, 1, 0, true);
142:            }
143:
144:            //---------
145:            public static class ITC_False1 extends IntegrationTestCase {
146:                public ITC_False1(String name) {
147:                    super (name);
148:                }
149:
150:                public void test1() {
151:                    softAssertFalse(false);
152:                }
153:            }
154:
155:            public void testSoftAssertFalse1() {
156:                // Ensure that two tests run, and there is one failure.
157:                runITC(ITC_False1.class, 2, 0, 0, false);
158:            }
159:
160:            //---------
161:            public static class ITC_False2 extends IntegrationTestCase {
162:                public ITC_False2(String name) {
163:                    super (name);
164:                }
165:
166:                public void test1() {
167:                    softAssertFalse(MSG, false);
168:                }
169:            }
170:
171:            public void testSoftAssertFalse2() {
172:                // Ensure that two tests run, and there is one failure.
173:                runITC(ITC_False2.class, 2, 0, 0, true);
174:            }
175:
176:            //---------
177:            public static class ITC_False3 extends IntegrationTestCase {
178:                public ITC_False3(String name) {
179:                    super (name);
180:                }
181:
182:                public void test1() {
183:                    softAssertFalse(true);
184:                }
185:            }
186:
187:            public void testSoftAssertFalse3() {
188:                // Ensure that two tests run, and there is one failure.
189:                runITC(ITC_False3.class, 2, 1, 0, false);
190:            }
191:
192:            //---------
193:            public static class ITC_False4 extends IntegrationTestCase {
194:                public ITC_False4(String name) {
195:                    super (name);
196:                }
197:
198:                public void test1() {
199:                    softAssertFalse(MSG, true);
200:                }
201:            }
202:
203:            public void testSoftAssertFalse4() {
204:                // Ensure that two tests run, and there is one failure.
205:                runITC(ITC_False4.class, 2, 1, 0, true);
206:            }
207:
208:            //---------
209:            public static class ITC_Fail1 extends IntegrationTestCase {
210:                public ITC_Fail1(String name) {
211:                    super (name);
212:                }
213:
214:                public void test1() {
215:                    softFail();
216:                }
217:            }
218:
219:            public void testSoftFail1() {
220:                // Ensure that two tests run, and there is one failure.
221:                runITC(ITC_Fail1.class, 2, 1, 0, false);
222:            }
223:
224:            //---------
225:            public static class ITC_Fail2 extends IntegrationTestCase {
226:                public ITC_Fail2(String name) {
227:                    super (name);
228:                }
229:
230:                public void test1() {
231:                    softFail(MSG);
232:                }
233:            }
234:
235:            public void testSoftFail2() {
236:                // Ensure that two tests run, and there is one failure.
237:                runITC(ITC_Fail2.class, 2, 1, 0, true);
238:            }
239:
240:            //---------
241:            public static class ITC_NotNull_O1 extends IntegrationTestCase {
242:                public ITC_NotNull_O1(String name) {
243:                    super (name);
244:                }
245:
246:                public void test1() {
247:                    softAssertNotNull(null);
248:                }
249:            }
250:
251:            public void testSoftAssertNotNull_O1() {
252:                // Ensure that two tests run, and there is one failure.
253:                runITC(ITC_NotNull_O1.class, 2, 1, 0, false);
254:            }
255:
256:            //---------
257:            public static class ITC_NotNull_O2 extends IntegrationTestCase {
258:                public ITC_NotNull_O2(String name) {
259:                    super (name);
260:                }
261:
262:                public void test1() {
263:                    softAssertNotNull(new Object());
264:                }
265:            }
266:
267:            public void testSoftAssertNotNull_O2() {
268:                // Ensure that two tests run, and there are no failures.
269:                runITC(ITC_NotNull_O2.class, 2, 0, 0, false);
270:            }
271:
272:            //---------
273:            public static class ITC_Equals_SJJ1 extends IntegrationTestCase {
274:                public ITC_Equals_SJJ1(String name) {
275:                    super (name);
276:                }
277:
278:                public void test1() {
279:                    softAssertEquals(MSG, Long.MIN_VALUE, Long.MAX_VALUE);
280:                }
281:            }
282:
283:            public void testSoftAssertEquals_SJJ1() {
284:                // Ensure that two tests run, and there is one failure.
285:                runITC(ITC_Equals_SJJ1.class, 2, 1, 0, true);
286:            }
287:
288:            //---------
289:            public static class ITC_NotSame_SOO1 extends IntegrationTestCase {
290:                public ITC_NotSame_SOO1(String name) {
291:                    super (name);
292:                }
293:
294:                public void test1() {
295:                    Object o = new Object();
296:                    softAssertNotSame(MSG, o, o);
297:                }
298:            }
299:
300:            public void testSoftAssertNotSame_SOO1() {
301:                // Ensure that two tests run, and there is one failure.
302:                runITC(ITC_NotSame_SOO1.class, 2, 1, 0, true);
303:            }
304:
305:            //---------
306:            public static class ITC_Equals_SOO1 extends IntegrationTestCase {
307:                public ITC_Equals_SOO1(String name) {
308:                    super (name);
309:                }
310:
311:                public void test1() {
312:                    softAssertEquals(MSG, new Object(), "check string");
313:                }
314:            }
315:
316:            public void testSoftAssertEquals_SOO1() {
317:                // Ensure that two tests run, and there is one failure.
318:                runITC(ITC_Equals_SOO1.class, 2, 1, 0, true);
319:            }
320:
321:            //---------
322:            public static class ITC_NotSame_OO1 extends IntegrationTestCase {
323:                public ITC_NotSame_OO1(String name) {
324:                    super (name);
325:                }
326:
327:                public void test1() {
328:                    Object o = new Object();
329:                    softAssertNotSame(o, o);
330:                }
331:            }
332:
333:            public void testSoftAssertNotSame_OO1() {
334:                // Ensure that two tests run, and there is one failure.
335:                runITC(ITC_NotSame_OO1.class, 2, 1, 0, false);
336:            }
337:
338:            //---------
339:            public static class ITC_Null_SO1 extends IntegrationTestCase {
340:                public ITC_Null_SO1(String name) {
341:                    super (name);
342:                }
343:
344:                public void test1() {
345:                    softAssertNull(MSG, new Object());
346:                }
347:            }
348:
349:            public void testSoftAssertNull_SO1() {
350:                // Ensure that two tests run, and there is one failure.
351:                runITC(ITC_Null_SO1.class, 2, 1, 0, true);
352:            }
353:
354:            //---------
355:            public static class ITC_Equals_XX1 extends IntegrationTestCase {
356:                public ITC_Equals_XX1(String name) {
357:                    super (name);
358:                }
359:
360:                public void test1() {
361:                    softAssertEquals(Short.MAX_VALUE, Short.MIN_VALUE);
362:                }
363:            }
364:
365:            public void testSoftAssertEquals_XX1() {
366:                // Ensure that two tests run, and there is one failure.
367:                runITC(ITC_Equals_XX1.class, 2, 1, 0, false);
368:            }
369:
370:            //---------
371:            public static class ITC_Equals_OO1 extends IntegrationTestCase {
372:                public ITC_Equals_OO1(String name) {
373:                    super (name);
374:                }
375:
376:                public void test1() {
377:                    softAssertEquals(new Object(), "t2");
378:                }
379:            }
380:
381:            public void testSoftAssertEquals_OO1() {
382:                // Ensure that two tests run, and there is one failure.
383:                runITC(ITC_Equals_OO1.class, 2, 1, 0, false);
384:            }
385:
386:            //---------
387:            public static class ITC_Equals_SSS1 extends IntegrationTestCase {
388:                public ITC_Equals_SSS1(String name) {
389:                    super (name);
390:                }
391:
392:                public void test1() {
393:                    softAssertEquals(MSG, "t1", "t2");
394:                }
395:            }
396:
397:            public void testSoftAssertEquals_SSS1() {
398:                // Ensure that two tests run, and there is one failure.
399:                runITC(ITC_Equals_SSS1.class, 2, 1, 0, true);
400:            }
401:
402:            //---------
403:            public static class ITC_Equals_BB1 extends IntegrationTestCase {
404:                public ITC_Equals_BB1(String name) {
405:                    super (name);
406:                }
407:
408:                public void test1() {
409:                    softAssertEquals(Byte.MAX_VALUE, Byte.MIN_VALUE);
410:                }
411:            }
412:
413:            public void testSoftAssertEquals_BB1() {
414:                // Ensure that two tests run, and there is one failure.
415:                runITC(ITC_Equals_BB1.class, 2, 1, 0, false);
416:            }
417:
418:            //---------
419:            public static class ITC_Equals_SFFF1 extends IntegrationTestCase {
420:                public ITC_Equals_SFFF1(String name) {
421:                    super (name);
422:                }
423:
424:                public void test1() {
425:                    softAssertEquals(MSG, Float.MIN_VALUE, Float.MAX_VALUE,
426:                            10.0f);
427:                }
428:            }
429:
430:            public void testSoftAssertEquals_SFFF1() {
431:                // Ensure that two tests run, and there is one failure.
432:                runITC(ITC_Equals_SFFF1.class, 2, 1, 0, true);
433:            }
434:
435:            //---------
436:            public static class ITC_Equals_SCC1 extends IntegrationTestCase {
437:                public ITC_Equals_SCC1(String name) {
438:                    super (name);
439:                }
440:
441:                public void test1() {
442:                    softAssertEquals(MSG, '1', '2');
443:                }
444:            }
445:
446:            public void testSoftAssertEquals_SCC1() {
447:                // Ensure that two tests run, and there is one failure.
448:                runITC(ITC_Equals_SCC1.class, 2, 1, 0, true);
449:            }
450:
451:            //---------
452:            public static class ITC_Same_OO1 extends IntegrationTestCase {
453:                public ITC_Same_OO1(String name) {
454:                    super (name);
455:                }
456:
457:                public void test1() {
458:                    softAssertSame(new Object(), new Object());
459:                }
460:            }
461:
462:            public void testSoftAssertSame_OO1() {
463:                // Ensure that two tests run, and there is one failure.
464:                runITC(ITC_Same_OO1.class, 2, 1, 0, false);
465:            }
466:
467:            //---------
468:            public static class ITC_Equals_JJ1 extends IntegrationTestCase {
469:                public ITC_Equals_JJ1(String name) {
470:                    super (name);
471:                }
472:
473:                public void test1() {
474:                    softAssertEquals(Long.MIN_VALUE, Long.MAX_VALUE);
475:                }
476:            }
477:
478:            public void testSoftAssertEquals_JJ1() {
479:                // Ensure that two tests run, and there is one failure.
480:                runITC(ITC_Equals_JJ1.class, 2, 1, 0, false);
481:            }
482:
483:            //---------
484:            public static class ITC_Equals_SZZ1 extends IntegrationTestCase {
485:                public ITC_Equals_SZZ1(String name) {
486:                    super (name);
487:                }
488:
489:                public void test1() {
490:                    softAssertEquals(MSG, true, false);
491:                }
492:            }
493:
494:            public void testSoftAssertEquals_SZZ1() {
495:                // Ensure that two tests run, and there is one failure.
496:                runITC(ITC_Equals_SZZ1.class, 2, 1, 0, true);
497:            }
498:
499:            //---------
500:            public static class ITC_Equals_DDD1 extends IntegrationTestCase {
501:                public ITC_Equals_DDD1(String name) {
502:                    super (name);
503:                }
504:
505:                public void test1() {
506:                    softAssertEquals(Double.MAX_VALUE, Double.MIN_VALUE, 1.0);
507:                }
508:            }
509:
510:            public void testSoftAssertEquals_DDD1() {
511:                // Ensure that two tests run, and there is one failure.
512:                runITC(ITC_Equals_DDD1.class, 2, 1, 0, false);
513:            }
514:
515:            //---------
516:            public static class ITC_Same_SOO1 extends IntegrationTestCase {
517:                public ITC_Same_SOO1(String name) {
518:                    super (name);
519:                }
520:
521:                public void test1() {
522:                    softAssertSame(MSG, new Object(), new Object());
523:                }
524:            }
525:
526:            public void testSoftAssertSame_SOO1() {
527:                // Ensure that two tests run, and there is one failure.
528:                runITC(ITC_Same_SOO1.class, 2, 1, 0, true);
529:            }
530:
531:            //---------
532:            public static class ITC_NotNull_SO1 extends IntegrationTestCase {
533:                public ITC_NotNull_SO1(String name) {
534:                    super (name);
535:                }
536:
537:                public void test1() {
538:                    softAssertNotNull(MSG, null);
539:                }
540:            }
541:
542:            public void testSoftAssertNotNull_SO1() {
543:                // Ensure that two tests run, and there is one failure.
544:                runITC(ITC_NotNull_SO1.class, 2, 1, 0, true);
545:            }
546:
547:            //---------
548:            public static class ITC_Equals_SII1 extends IntegrationTestCase {
549:                public ITC_Equals_SII1(String name) {
550:                    super (name);
551:                }
552:
553:                public void test1() {
554:                    softAssertEquals(MSG, Integer.MIN_VALUE, Integer.MAX_VALUE);
555:                }
556:            }
557:
558:            public void testSoftAssertEquals_SII1() {
559:                // Ensure that two tests run, and there is one failure.
560:                runITC(ITC_Equals_SII1.class, 2, 1, 0, true);
561:            }
562:
563:            //---------
564:            public static class ITC_Null_O1 extends IntegrationTestCase {
565:                public ITC_Null_O1(String name) {
566:                    super (name);
567:                }
568:
569:                public void test1() {
570:                    softAssertNull(new Object());
571:                }
572:            }
573:
574:            public void testSoftAssertNull_O1() {
575:                // Ensure that two tests run, and there is one failure.
576:                runITC(ITC_Null_O1.class, 2, 1, 0, false);
577:            }
578:
579:            //---------
580:            public static class ITC_Equals_SDDD1 extends IntegrationTestCase {
581:                public ITC_Equals_SDDD1(String name) {
582:                    super (name);
583:                }
584:
585:                public void test1() {
586:                    softAssertEquals(MSG, Double.MIN_VALUE, Double.MAX_VALUE,
587:                            1.0);
588:                }
589:            }
590:
591:            public void testSoftAssertEquals_SDDD1() {
592:                // Ensure that two tests run, and there is one failure.
593:                runITC(ITC_Equals_SDDD1.class, 2, 1, 0, true);
594:            }
595:
596:            //---------
597:            public static class ITC_Equals_CC1 extends IntegrationTestCase {
598:                public ITC_Equals_CC1(String name) {
599:                    super (name);
600:                }
601:
602:                public void test1() {
603:                    softAssertEquals('a', 'b');
604:                }
605:            }
606:
607:            public void testSoftAssertEquals_CC1() {
608:                // Ensure that two tests run, and there is one failure.
609:                runITC(ITC_Equals_CC1.class, 2, 1, 0, false);
610:            }
611:
612:            //---------
613:            public static class ITC_Equals_SXX1 extends IntegrationTestCase {
614:                public ITC_Equals_SXX1(String name) {
615:                    super (name);
616:                }
617:
618:                public void test1() {
619:                    softAssertEquals(MSG, Short.MAX_VALUE, Short.MIN_VALUE);
620:                }
621:            }
622:
623:            public void testSoftAssertEquals_SXX1() {
624:                // Ensure that two tests run, and there is one failure.
625:                runITC(ITC_Equals_SXX1.class, 2, 1, 0, true);
626:            }
627:
628:            //---------
629:            public static class ITC_Equals_ZZ1 extends IntegrationTestCase {
630:                public ITC_Equals_ZZ1(String name) {
631:                    super (name);
632:                }
633:
634:                public void test1() {
635:                    softAssertEquals(true, false);
636:                }
637:            }
638:
639:            public void testSoftAssertEquals_ZZ1() {
640:                // Ensure that two tests run, and there is one failure.
641:                runITC(ITC_Equals_ZZ1.class, 2, 1, 0, false);
642:            }
643:
644:            //---------
645:            public static class ITC_Equals_SBB1 extends IntegrationTestCase {
646:                public ITC_Equals_SBB1(String name) {
647:                    super (name);
648:                }
649:
650:                public void test1() {
651:                    softAssertEquals(MSG, Byte.MAX_VALUE, Byte.MIN_VALUE);
652:                }
653:            }
654:
655:            public void testSoftAssertEquals_SBB1() {
656:                // Ensure that two tests run, and there is one failure.
657:                runITC(ITC_Equals_SBB1.class, 2, 1, 0, true);
658:            }
659:
660:            //---------
661:            public static class ITC_Equals_SS1 extends IntegrationTestCase {
662:                public ITC_Equals_SS1(String name) {
663:                    super (name);
664:                }
665:
666:                public void test1() {
667:                    softAssertEquals("t1", "t2");
668:                }
669:            }
670:
671:            public void testSoftAssertEquals_SS1() {
672:                // Ensure that two tests run, and there is one failure.
673:                runITC(ITC_Equals_SS1.class, 2, 1, 0, false);
674:            }
675:
676:            //---------
677:            public static class ITC_Equals_II1 extends IntegrationTestCase {
678:                public ITC_Equals_II1(String name) {
679:                    super (name);
680:                }
681:
682:                public void test1() {
683:                    softAssertEquals(Integer.MAX_VALUE, Integer.MIN_VALUE);
684:                }
685:            }
686:
687:            public void testSoftAssertEquals_II1() {
688:                // Ensure that two tests run, and there is one failure.
689:                runITC(ITC_Equals_II1.class, 2, 1, 0, false);
690:            }
691:
692:            //---------
693:            public static class ITC_Equals_FFF1 extends IntegrationTestCase {
694:                public ITC_Equals_FFF1(String name) {
695:                    super (name);
696:                }
697:
698:                public void test1() {
699:                    softAssertEquals(Float.MAX_VALUE, Float.MIN_VALUE, 1.0f);
700:                }
701:            }
702:
703:            public void testSoftAssertEquals_FFF1() {
704:                // Ensure that two tests run, and there is one failure.
705:                runITC(ITC_Equals_FFF1.class, 2, 1, 0, false);
706:            }
707:
708:            //-------------------------------------------------------------------------
709:            // Helpers
710:
711:            protected IntegrationTestCase createIntegrationTestCase() {
712:                return new IntegrationTestCase("name");
713:            }
714:
715:            protected TestResult runITC( Class itcClass,
716:            int runCount, int failureCount, int errorCount,
717:            boolean hasMessage )
718:    {
719:        TestSuite suite = new TestSuite( itcClass );
720:        TestResult tr = new TestResult();
721:        LOG.info( "Running tests..." );
722:        try
723:        {
724:            suite.run( tr );
725:        }
726:        catch (RuntimeException re)
727:        {
728:            re.printStackTrace();
729:            throw re;
730:        }
731:        catch (Error e)
732:        {
733:            e.printStackTrace();
734:            throw e;
735:        }
736:        LOG.info( "Expected "+runCount+" runs, but found "+tr.runCount()+"." );
737:        LOG.info( "Expected "+failureCount+" failures, but found "+
738:            tr.failureCount()+"." );
739:        LOG.info( "Expected "+errorCount+" errors, but found "+
740:            tr.errorCount()+"." );
741:        //LOG.info( tr.failures().nextElement().toString() );
742:        assertEquals(
743:            "Did not have the correct number of failures.",
744:            failureCount,
745:            tr.failureCount() );
746:        assertEquals(
747:            "Did not have the correct number of errors.",
748:            errorCount,
749:            tr.errorCount() );
750:        assertEquals(
751:            "Did not have the correct number of test runs.",
752:            runCount,
753:            tr.runCount() );
754:        Enumeration enum = tr.failures();
755:        while (enum.hasMoreElements())
756:        {
757:            TestFailure tf = (TestFailure)enum.nextElement();
758:            String msg = tf.thrownException().getMessage();
759:            assertEquals(
760:                "Message expectation not met (true = has message);",
761:                hasMessage,
762:                msg.indexOf( MSG ) >= 0 );
763:        }
764:        return tr;
765:    }
766:
767:            //-------------------------------------------------------------------------
768:            // Standard JUnit declarations
769:
770:            public static Test suite() {
771:                TestSuite suite = new TestSuite(THIS_CLASS);
772:
773:                return suite;
774:            }
775:
776:            public static void main(String[] args) {
777:                String[] name = { THIS_CLASS.getName() };
778:
779:                // junit.textui.TestRunner.main( name );
780:                // junit.swingui.TestRunner.main( name );
781:
782:                junit.textui.TestRunner.main(name);
783:            }
784:
785:            /**
786:             * 
787:             * @exception Exception thrown under any exceptional condition.
788:             */
789:            protected void setUp() throws Exception {
790:                super .setUp();
791:
792:                // set ourself up
793:            }
794:
795:            /**
796:             * 
797:             * @exception Exception thrown under any exceptional condition.
798:             */
799:            protected void tearDown() throws Exception {
800:                // tear ourself down
801:
802:                super.tearDown();
803:            }
804:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.