Source Code Cross Referenced for TestTextPrinter.java in  » Code-Analyzer » DependencyFinder » com » jeantessier » dependency » 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 » Code Analyzer » DependencyFinder » com.jeantessier.dependency 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         *  Copyright (c) 2001-2007, Jean Tessier
0003:         *  All rights reserved.
0004:         *  
0005:         *  Redistribution and use in source and binary forms, with or without
0006:         *  modification, are permitted provided that the following conditions
0007:         *  are met:
0008:         *  
0009:         *      * Redistributions of source code must retain the above copyright
0010:         *        notice, this list of conditions and the following disclaimer.
0011:         *  
0012:         *      * Redistributions in binary form must reproduce the above copyright
0013:         *        notice, this list of conditions and the following disclaimer in the
0014:         *        documentation and/or other materials provided with the distribution.
0015:         *  
0016:         *      * Neither the name of Jean Tessier nor the names of his contributors
0017:         *        may be used to endorse or promote products derived from this software
0018:         *        without specific prior written permission.
0019:         *  
0020:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0021:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0022:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0023:         *  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
0024:         *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0025:         *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0026:         *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
0027:         *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
0028:         *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0029:         *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0030:         *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0031:         */
0032:
0033:        package com.jeantessier.dependency;
0034:
0035:        import java.io.*;
0036:
0037:        import junit.framework.*;
0038:
0039:        public class TestTextPrinter extends TestCase {
0040:            private NodeFactory factory;
0041:            private StringWriter out;
0042:            private TextPrinter visitor;
0043:
0044:            protected void setUp() throws Exception {
0045:                factory = new NodeFactory();
0046:                out = new StringWriter();
0047:                visitor = new TextPrinter(new PrintWriter(out));
0048:            }
0049:
0050:            public void testShowInboundsPackageTrueWithInferred()
0051:                    throws IOException {
0052:                factory.createPackage("outbound").addDependency(
0053:                        factory.createPackage("inbound"));
0054:                factory.createPackage("empty");
0055:
0056:                visitor.setShowInbounds(true);
0057:                visitor.setShowOutbounds(false);
0058:
0059:                visitor.traverseNodes(factory.getPackages().values());
0060:
0061:                int lineNumber = 0;
0062:                BufferedReader in = new BufferedReader(new StringReader(out
0063:                        .toString()));
0064:
0065:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0066:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0067:                assertEquals("line " + ++lineNumber, "    <-- outbound *", in
0068:                        .readLine());
0069:                assertEquals("line " + ++lineNumber, "outbound *", in
0070:                        .readLine());
0071:
0072:                assertEquals("End of file", null, in.readLine());
0073:            }
0074:
0075:            public void testShowInboundsPackageTrueWithConfirmed()
0076:                    throws IOException {
0077:                factory.createPackage("outbound", true).addDependency(
0078:                        factory.createPackage("inbound", true));
0079:                factory.createPackage("empty", true);
0080:
0081:                visitor.setShowInbounds(true);
0082:                visitor.setShowOutbounds(false);
0083:
0084:                visitor.traverseNodes(factory.getPackages().values());
0085:
0086:                int lineNumber = 0;
0087:                BufferedReader in = new BufferedReader(new StringReader(out
0088:                        .toString()));
0089:
0090:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0091:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0092:                assertEquals("line " + ++lineNumber, "    <-- outbound", in
0093:                        .readLine());
0094:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0095:
0096:                assertEquals("End of file", null, in.readLine());
0097:            }
0098:
0099:            public void testShowInboundsPackageFalseWithInferred()
0100:                    throws IOException {
0101:                factory.createPackage("outbound").addDependency(
0102:                        factory.createPackage("inbound"));
0103:                factory.createPackage("empty");
0104:
0105:                visitor.setShowInbounds(false);
0106:                visitor.setShowOutbounds(false);
0107:
0108:                visitor.traverseNodes(factory.getPackages().values());
0109:
0110:                int lineNumber = 0;
0111:                BufferedReader in = new BufferedReader(new StringReader(out
0112:                        .toString()));
0113:
0114:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0115:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0116:                assertEquals("line " + ++lineNumber, "outbound *", in
0117:                        .readLine());
0118:
0119:                assertEquals("End of file", null, in.readLine());
0120:            }
0121:
0122:            public void testShowInboundsPackageFalseWithConfirmed()
0123:                    throws IOException {
0124:                factory.createPackage("outbound", true).addDependency(
0125:                        factory.createPackage("inbound", true));
0126:                factory.createPackage("empty", true);
0127:
0128:                visitor.setShowInbounds(false);
0129:                visitor.setShowOutbounds(false);
0130:
0131:                visitor.traverseNodes(factory.getPackages().values());
0132:
0133:                int lineNumber = 0;
0134:                BufferedReader in = new BufferedReader(new StringReader(out
0135:                        .toString()));
0136:
0137:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0138:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0139:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0140:
0141:                assertEquals("End of file", null, in.readLine());
0142:            }
0143:
0144:            public void testShowInboundsClassTrueWithInferred()
0145:                    throws IOException {
0146:                factory.createClass("outbound.Outbound").addDependency(
0147:                        factory.createClass("inbound.Inbound"));
0148:                factory.createClass("empty.Empty");
0149:
0150:                visitor.setShowInbounds(true);
0151:                visitor.setShowOutbounds(false);
0152:
0153:                visitor.traverseNodes(factory.getPackages().values());
0154:
0155:                int lineNumber = 0;
0156:                BufferedReader in = new BufferedReader(new StringReader(out
0157:                        .toString()));
0158:
0159:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0160:                assertEquals("line " + ++lineNumber, "    Empty *", in
0161:                        .readLine());
0162:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0163:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0164:                        .readLine());
0165:                assertEquals("line " + ++lineNumber,
0166:                        "        <-- outbound.Outbound *", in.readLine());
0167:                assertEquals("line " + ++lineNumber, "outbound *", in
0168:                        .readLine());
0169:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0170:                        .readLine());
0171:
0172:                assertEquals("End of file", null, in.readLine());
0173:            }
0174:
0175:            public void testShowInboundsClassTrueWithConfirmed()
0176:                    throws IOException {
0177:                factory.createClass("outbound.Outbound", true).addDependency(
0178:                        factory.createClass("inbound.Inbound", true));
0179:                factory.createClass("empty.Empty", true);
0180:
0181:                visitor.setShowInbounds(true);
0182:                visitor.setShowOutbounds(false);
0183:
0184:                visitor.traverseNodes(factory.getPackages().values());
0185:
0186:                int lineNumber = 0;
0187:                BufferedReader in = new BufferedReader(new StringReader(out
0188:                        .toString()));
0189:
0190:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0191:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0192:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0193:                assertEquals("line " + ++lineNumber, "    Inbound", in
0194:                        .readLine());
0195:                assertEquals("line " + ++lineNumber,
0196:                        "        <-- outbound.Outbound", in.readLine());
0197:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0198:                assertEquals("line " + ++lineNumber, "    Outbound", in
0199:                        .readLine());
0200:
0201:                assertEquals("End of file", null, in.readLine());
0202:            }
0203:
0204:            public void testShowInboundsClassFalseWithInferred()
0205:                    throws IOException {
0206:                factory.createClass("outbound.Outbound").addDependency(
0207:                        factory.createClass("inbound.Inbound"));
0208:                factory.createClass("empty.Empty");
0209:
0210:                visitor.setShowInbounds(false);
0211:                visitor.setShowOutbounds(false);
0212:
0213:                visitor.traverseNodes(factory.getPackages().values());
0214:
0215:                int lineNumber = 0;
0216:                BufferedReader in = new BufferedReader(new StringReader(out
0217:                        .toString()));
0218:
0219:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0220:                assertEquals("line " + ++lineNumber, "    Empty *", in
0221:                        .readLine());
0222:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0223:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0224:                        .readLine());
0225:                assertEquals("line " + ++lineNumber, "outbound *", in
0226:                        .readLine());
0227:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0228:                        .readLine());
0229:
0230:                assertEquals("End of file", null, in.readLine());
0231:            }
0232:
0233:            public void testShowInboundsClassFalseWithConfirmed()
0234:                    throws IOException {
0235:                factory.createClass("outbound.Outbound", true).addDependency(
0236:                        factory.createClass("inbound.Inbound", true));
0237:                factory.createClass("empty.Empty", true);
0238:
0239:                visitor.setShowInbounds(false);
0240:                visitor.setShowOutbounds(false);
0241:
0242:                visitor.traverseNodes(factory.getPackages().values());
0243:
0244:                int lineNumber = 0;
0245:                BufferedReader in = new BufferedReader(new StringReader(out
0246:                        .toString()));
0247:
0248:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0249:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0250:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0251:                assertEquals("line " + ++lineNumber, "    Inbound", in
0252:                        .readLine());
0253:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0254:                assertEquals("line " + ++lineNumber, "    Outbound", in
0255:                        .readLine());
0256:
0257:                assertEquals("End of file", null, in.readLine());
0258:            }
0259:
0260:            public void testShowInboundsFeatureTrueWithInferred()
0261:                    throws IOException {
0262:                factory
0263:                        .createFeature("outbound.Outbound.outbound()")
0264:                        .addDependency(
0265:                                factory
0266:                                        .createFeature("inbound.Inbound.inbound()"));
0267:                factory.createFeature("empty.Empty.empty()");
0268:
0269:                visitor.setShowInbounds(true);
0270:                visitor.setShowOutbounds(false);
0271:
0272:                visitor.traverseNodes(factory.getPackages().values());
0273:
0274:                int lineNumber = 0;
0275:                BufferedReader in = new BufferedReader(new StringReader(out
0276:                        .toString()));
0277:
0278:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0279:                assertEquals("line " + ++lineNumber, "    Empty *", in
0280:                        .readLine());
0281:                assertEquals("line " + ++lineNumber, "        empty() *", in
0282:                        .readLine());
0283:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0284:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0285:                        .readLine());
0286:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0287:                        .readLine());
0288:                assertEquals("line " + ++lineNumber,
0289:                        "            <-- outbound.Outbound.outbound() *", in
0290:                                .readLine());
0291:                assertEquals("line " + ++lineNumber, "outbound *", in
0292:                        .readLine());
0293:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0294:                        .readLine());
0295:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0296:                        .readLine());
0297:
0298:                assertEquals("End of file", null, in.readLine());
0299:            }
0300:
0301:            public void testShowInboundsFeatureTrueWithConfirmed()
0302:                    throws IOException {
0303:                factory.createFeature("outbound.Outbound.outbound()", true)
0304:                        .addDependency(
0305:                                factory.createFeature(
0306:                                        "inbound.Inbound.inbound()", true));
0307:                factory.createFeature("empty.Empty.empty()", true);
0308:
0309:                visitor.setShowInbounds(true);
0310:                visitor.setShowOutbounds(false);
0311:
0312:                visitor.traverseNodes(factory.getPackages().values());
0313:
0314:                int lineNumber = 0;
0315:                BufferedReader in = new BufferedReader(new StringReader(out
0316:                        .toString()));
0317:
0318:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0319:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0320:                assertEquals("line " + ++lineNumber, "        empty()", in
0321:                        .readLine());
0322:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0323:                assertEquals("line " + ++lineNumber, "    Inbound", in
0324:                        .readLine());
0325:                assertEquals("line " + ++lineNumber, "        inbound()", in
0326:                        .readLine());
0327:                assertEquals("line " + ++lineNumber,
0328:                        "            <-- outbound.Outbound.outbound()", in
0329:                                .readLine());
0330:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0331:                assertEquals("line " + ++lineNumber, "    Outbound", in
0332:                        .readLine());
0333:                assertEquals("line " + ++lineNumber, "        outbound()", in
0334:                        .readLine());
0335:
0336:                assertEquals("End of file", null, in.readLine());
0337:            }
0338:
0339:            public void testShowInboundsFeatureFalseWithInferred()
0340:                    throws IOException {
0341:                factory
0342:                        .createFeature("outbound.Outbound.outbound()")
0343:                        .addDependency(
0344:                                factory
0345:                                        .createFeature("inbound.Inbound.inbound()"));
0346:                factory.createFeature("empty.Empty.empty()");
0347:
0348:                visitor.setShowInbounds(false);
0349:                visitor.setShowOutbounds(false);
0350:
0351:                visitor.traverseNodes(factory.getPackages().values());
0352:
0353:                int lineNumber = 0;
0354:                BufferedReader in = new BufferedReader(new StringReader(out
0355:                        .toString()));
0356:
0357:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0358:                assertEquals("line " + ++lineNumber, "    Empty *", in
0359:                        .readLine());
0360:                assertEquals("line " + ++lineNumber, "        empty() *", in
0361:                        .readLine());
0362:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0363:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0364:                        .readLine());
0365:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0366:                        .readLine());
0367:                assertEquals("line " + ++lineNumber, "outbound *", in
0368:                        .readLine());
0369:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0370:                        .readLine());
0371:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0372:                        .readLine());
0373:
0374:                assertEquals("End of file", null, in.readLine());
0375:            }
0376:
0377:            public void testShowInboundsFeatureFalseWithConfirmed()
0378:                    throws IOException {
0379:                factory.createFeature("outbound.Outbound.outbound()", true)
0380:                        .addDependency(
0381:                                factory.createFeature(
0382:                                        "inbound.Inbound.inbound()", true));
0383:                factory.createFeature("empty.Empty.empty()", true);
0384:
0385:                visitor.setShowInbounds(false);
0386:                visitor.setShowOutbounds(false);
0387:
0388:                visitor.traverseNodes(factory.getPackages().values());
0389:
0390:                int lineNumber = 0;
0391:                BufferedReader in = new BufferedReader(new StringReader(out
0392:                        .toString()));
0393:
0394:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0395:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0396:                assertEquals("line " + ++lineNumber, "        empty()", in
0397:                        .readLine());
0398:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0399:                assertEquals("line " + ++lineNumber, "    Inbound", in
0400:                        .readLine());
0401:                assertEquals("line " + ++lineNumber, "        inbound()", in
0402:                        .readLine());
0403:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0404:                assertEquals("line " + ++lineNumber, "    Outbound", in
0405:                        .readLine());
0406:                assertEquals("line " + ++lineNumber, "        outbound()", in
0407:                        .readLine());
0408:
0409:                assertEquals("End of file", null, in.readLine());
0410:            }
0411:
0412:            public void testShowOutboundsPackageTrueWithInferred()
0413:                    throws IOException {
0414:                factory.createPackage("outbound").addDependency(
0415:                        factory.createPackage("inbound"));
0416:                factory.createPackage("empty");
0417:
0418:                visitor.setShowInbounds(false);
0419:                visitor.setShowOutbounds(true);
0420:
0421:                visitor.traverseNodes(factory.getPackages().values());
0422:
0423:                int lineNumber = 0;
0424:                BufferedReader in = new BufferedReader(new StringReader(out
0425:                        .toString()));
0426:
0427:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0428:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0429:                assertEquals("line " + ++lineNumber, "outbound *", in
0430:                        .readLine());
0431:                assertEquals("line " + ++lineNumber, "    --> inbound *", in
0432:                        .readLine());
0433:
0434:                assertEquals("End of file", null, in.readLine());
0435:            }
0436:
0437:            public void testShowOutboundsPackageTrueWithConfirmed()
0438:                    throws IOException {
0439:                factory.createPackage("outbound", true).addDependency(
0440:                        factory.createPackage("inbound", true));
0441:                factory.createPackage("empty", true);
0442:
0443:                visitor.setShowInbounds(false);
0444:                visitor.setShowOutbounds(true);
0445:
0446:                visitor.traverseNodes(factory.getPackages().values());
0447:
0448:                int lineNumber = 0;
0449:                BufferedReader in = new BufferedReader(new StringReader(out
0450:                        .toString()));
0451:
0452:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0453:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0454:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0455:                assertEquals("line " + ++lineNumber, "    --> inbound", in
0456:                        .readLine());
0457:
0458:                assertEquals("End of file", null, in.readLine());
0459:            }
0460:
0461:            public void testShowOutboundsPackageFalseWithInferred()
0462:                    throws IOException {
0463:                factory.createPackage("outbound").addDependency(
0464:                        factory.createPackage("inbound"));
0465:                factory.createPackage("empty");
0466:
0467:                visitor.setShowInbounds(false);
0468:                visitor.setShowOutbounds(false);
0469:
0470:                visitor.traverseNodes(factory.getPackages().values());
0471:
0472:                int lineNumber = 0;
0473:                BufferedReader in = new BufferedReader(new StringReader(out
0474:                        .toString()));
0475:
0476:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0477:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0478:                assertEquals("line " + ++lineNumber, "outbound *", in
0479:                        .readLine());
0480:
0481:                assertEquals("End of file", null, in.readLine());
0482:            }
0483:
0484:            public void testShowOutboundsPackageFalseWithConfirmed()
0485:                    throws IOException {
0486:                factory.createPackage("outbound", true).addDependency(
0487:                        factory.createPackage("inbound", true));
0488:                factory.createPackage("empty", true);
0489:
0490:                visitor.setShowInbounds(false);
0491:                visitor.setShowOutbounds(false);
0492:
0493:                visitor.traverseNodes(factory.getPackages().values());
0494:
0495:                int lineNumber = 0;
0496:                BufferedReader in = new BufferedReader(new StringReader(out
0497:                        .toString()));
0498:
0499:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0500:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0501:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0502:
0503:                assertEquals("End of file", null, in.readLine());
0504:            }
0505:
0506:            public void testShowOutboundsClassTrueWithInferred()
0507:                    throws IOException {
0508:                factory.createClass("outbound.Outbound").addDependency(
0509:                        factory.createClass("inbound.Inbound"));
0510:                factory.createClass("empty.Empty");
0511:
0512:                visitor.setShowInbounds(false);
0513:                visitor.setShowOutbounds(true);
0514:
0515:                visitor.traverseNodes(factory.getPackages().values());
0516:
0517:                int lineNumber = 0;
0518:                BufferedReader in = new BufferedReader(new StringReader(out
0519:                        .toString()));
0520:
0521:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0522:                assertEquals("line " + ++lineNumber, "    Empty *", in
0523:                        .readLine());
0524:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0525:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0526:                        .readLine());
0527:                assertEquals("line " + ++lineNumber, "outbound *", in
0528:                        .readLine());
0529:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0530:                        .readLine());
0531:                assertEquals("line " + ++lineNumber,
0532:                        "        --> inbound.Inbound *", in.readLine());
0533:
0534:                assertEquals("End of file", null, in.readLine());
0535:            }
0536:
0537:            public void testShowOutboundsClassTrueWithConfirmed()
0538:                    throws IOException {
0539:                factory.createClass("outbound.Outbound", true).addDependency(
0540:                        factory.createClass("inbound.Inbound", true));
0541:                factory.createClass("empty.Empty", true);
0542:
0543:                visitor.setShowInbounds(false);
0544:                visitor.setShowOutbounds(true);
0545:
0546:                visitor.traverseNodes(factory.getPackages().values());
0547:
0548:                int lineNumber = 0;
0549:                BufferedReader in = new BufferedReader(new StringReader(out
0550:                        .toString()));
0551:
0552:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0553:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0554:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0555:                assertEquals("line " + ++lineNumber, "    Inbound", in
0556:                        .readLine());
0557:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0558:                assertEquals("line " + ++lineNumber, "    Outbound", in
0559:                        .readLine());
0560:                assertEquals("line " + ++lineNumber,
0561:                        "        --> inbound.Inbound", in.readLine());
0562:
0563:                assertEquals("End of file", null, in.readLine());
0564:            }
0565:
0566:            public void testShowOutboundsClassFalseWithInferred()
0567:                    throws IOException {
0568:                factory.createClass("outbound.Outbound").addDependency(
0569:                        factory.createClass("inbound.Inbound"));
0570:                factory.createClass("empty.Empty");
0571:
0572:                visitor.setShowInbounds(false);
0573:                visitor.setShowOutbounds(false);
0574:
0575:                visitor.traverseNodes(factory.getPackages().values());
0576:
0577:                int lineNumber = 0;
0578:                BufferedReader in = new BufferedReader(new StringReader(out
0579:                        .toString()));
0580:
0581:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0582:                assertEquals("line " + ++lineNumber, "    Empty *", in
0583:                        .readLine());
0584:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0585:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0586:                        .readLine());
0587:                assertEquals("line " + ++lineNumber, "outbound *", in
0588:                        .readLine());
0589:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0590:                        .readLine());
0591:
0592:                assertEquals("End of file", null, in.readLine());
0593:            }
0594:
0595:            public void testShowOutboundsClassFalseWithConfirmed()
0596:                    throws IOException {
0597:                factory.createClass("outbound.Outbound", true).addDependency(
0598:                        factory.createClass("inbound.Inbound", true));
0599:                factory.createClass("empty.Empty", true);
0600:
0601:                visitor.setShowInbounds(false);
0602:                visitor.setShowOutbounds(false);
0603:
0604:                visitor.traverseNodes(factory.getPackages().values());
0605:
0606:                int lineNumber = 0;
0607:                BufferedReader in = new BufferedReader(new StringReader(out
0608:                        .toString()));
0609:
0610:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0611:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0612:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0613:                assertEquals("line " + ++lineNumber, "    Inbound", in
0614:                        .readLine());
0615:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0616:                assertEquals("line " + ++lineNumber, "    Outbound", in
0617:                        .readLine());
0618:
0619:                assertEquals("End of file", null, in.readLine());
0620:            }
0621:
0622:            public void testShowOutboundsFeatureTrueWithInferred()
0623:                    throws IOException {
0624:                factory
0625:                        .createFeature("outbound.Outbound.outbound()")
0626:                        .addDependency(
0627:                                factory
0628:                                        .createFeature("inbound.Inbound.inbound()"));
0629:                factory.createFeature("empty.Empty.empty()");
0630:
0631:                visitor.setShowInbounds(false);
0632:                visitor.setShowOutbounds(true);
0633:
0634:                visitor.traverseNodes(factory.getPackages().values());
0635:
0636:                int lineNumber = 0;
0637:                BufferedReader in = new BufferedReader(new StringReader(out
0638:                        .toString()));
0639:
0640:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0641:                assertEquals("line " + ++lineNumber, "    Empty *", in
0642:                        .readLine());
0643:                assertEquals("line " + ++lineNumber, "        empty() *", in
0644:                        .readLine());
0645:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0646:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0647:                        .readLine());
0648:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0649:                        .readLine());
0650:                assertEquals("line " + ++lineNumber, "outbound *", in
0651:                        .readLine());
0652:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0653:                        .readLine());
0654:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0655:                        .readLine());
0656:                assertEquals("line " + ++lineNumber,
0657:                        "            --> inbound.Inbound.inbound() *", in
0658:                                .readLine());
0659:
0660:                assertEquals("End of file", null, in.readLine());
0661:            }
0662:
0663:            public void testShowOutboundsFeatureTrueWithConfirmed()
0664:                    throws IOException {
0665:                factory.createFeature("outbound.Outbound.outbound()", true)
0666:                        .addDependency(
0667:                                factory.createFeature(
0668:                                        "inbound.Inbound.inbound()", true));
0669:                factory.createFeature("empty.Empty.empty()", true);
0670:
0671:                visitor.setShowInbounds(false);
0672:                visitor.setShowOutbounds(true);
0673:
0674:                visitor.traverseNodes(factory.getPackages().values());
0675:
0676:                int lineNumber = 0;
0677:                BufferedReader in = new BufferedReader(new StringReader(out
0678:                        .toString()));
0679:
0680:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0681:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0682:                assertEquals("line " + ++lineNumber, "        empty()", in
0683:                        .readLine());
0684:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0685:                assertEquals("line " + ++lineNumber, "    Inbound", in
0686:                        .readLine());
0687:                assertEquals("line " + ++lineNumber, "        inbound()", in
0688:                        .readLine());
0689:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0690:                assertEquals("line " + ++lineNumber, "    Outbound", in
0691:                        .readLine());
0692:                assertEquals("line " + ++lineNumber, "        outbound()", in
0693:                        .readLine());
0694:                assertEquals("line " + ++lineNumber,
0695:                        "            --> inbound.Inbound.inbound()", in
0696:                                .readLine());
0697:
0698:                assertEquals("End of file", null, in.readLine());
0699:            }
0700:
0701:            public void testShowOutboundsFeatureFalseWithInferred()
0702:                    throws IOException {
0703:                factory
0704:                        .createFeature("outbound.Outbound.outbound()")
0705:                        .addDependency(
0706:                                factory
0707:                                        .createFeature("inbound.Inbound.inbound()"));
0708:                factory.createFeature("empty.Empty.empty()");
0709:
0710:                visitor.setShowInbounds(false);
0711:                visitor.setShowOutbounds(false);
0712:
0713:                visitor.traverseNodes(factory.getPackages().values());
0714:
0715:                int lineNumber = 0;
0716:                BufferedReader in = new BufferedReader(new StringReader(out
0717:                        .toString()));
0718:
0719:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0720:                assertEquals("line " + ++lineNumber, "    Empty *", in
0721:                        .readLine());
0722:                assertEquals("line " + ++lineNumber, "        empty() *", in
0723:                        .readLine());
0724:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0725:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0726:                        .readLine());
0727:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0728:                        .readLine());
0729:                assertEquals("line " + ++lineNumber, "outbound *", in
0730:                        .readLine());
0731:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0732:                        .readLine());
0733:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0734:                        .readLine());
0735:
0736:                assertEquals("End of file", null, in.readLine());
0737:            }
0738:
0739:            public void testShowOutboundsFeatureFalseWithConfirmed()
0740:                    throws IOException {
0741:                factory.createFeature("outbound.Outbound.outbound()", true)
0742:                        .addDependency(
0743:                                factory.createFeature(
0744:                                        "inbound.Inbound.inbound()", true));
0745:                factory.createFeature("empty.Empty.empty()", true);
0746:
0747:                visitor.setShowInbounds(false);
0748:                visitor.setShowOutbounds(false);
0749:
0750:                visitor.traverseNodes(factory.getPackages().values());
0751:
0752:                int lineNumber = 0;
0753:                BufferedReader in = new BufferedReader(new StringReader(out
0754:                        .toString()));
0755:
0756:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0757:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
0758:                assertEquals("line " + ++lineNumber, "        empty()", in
0759:                        .readLine());
0760:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0761:                assertEquals("line " + ++lineNumber, "    Inbound", in
0762:                        .readLine());
0763:                assertEquals("line " + ++lineNumber, "        inbound()", in
0764:                        .readLine());
0765:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0766:                assertEquals("line " + ++lineNumber, "    Outbound", in
0767:                        .readLine());
0768:                assertEquals("line " + ++lineNumber, "        outbound()", in
0769:                        .readLine());
0770:
0771:                assertEquals("End of file", null, in.readLine());
0772:            }
0773:
0774:            public void testShowEmptyPackageTrueWithInferred()
0775:                    throws IOException {
0776:                factory.createPackage("outbound").addDependency(
0777:                        factory.createPackage("inbound"));
0778:                factory.createClass("outbound.Outbound").addDependency(
0779:                        factory.createClass("inbound.Inbound"));
0780:                factory
0781:                        .createFeature("outbound.Outbound.outbound()")
0782:                        .addDependency(
0783:                                factory
0784:                                        .createFeature("inbound.Inbound.inbound()"));
0785:                factory.createPackage("empty");
0786:
0787:                visitor.setShowEmptyNodes(true);
0788:
0789:                visitor.traverseNodes(factory.getPackages().values());
0790:
0791:                int lineNumber = 0;
0792:                BufferedReader in = new BufferedReader(new StringReader(out
0793:                        .toString()));
0794:
0795:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
0796:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0797:                assertEquals("line " + ++lineNumber, "    <-- outbound *", in
0798:                        .readLine());
0799:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0800:                        .readLine());
0801:                assertEquals("line " + ++lineNumber,
0802:                        "        <-- outbound.Outbound *", in.readLine());
0803:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0804:                        .readLine());
0805:                assertEquals("line " + ++lineNumber,
0806:                        "            <-- outbound.Outbound.outbound() *", in
0807:                                .readLine());
0808:                assertEquals("line " + ++lineNumber, "outbound *", in
0809:                        .readLine());
0810:                assertEquals("line " + ++lineNumber, "    --> inbound *", in
0811:                        .readLine());
0812:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0813:                        .readLine());
0814:                assertEquals("line " + ++lineNumber,
0815:                        "        --> inbound.Inbound *", in.readLine());
0816:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0817:                        .readLine());
0818:                assertEquals("line " + ++lineNumber,
0819:                        "            --> inbound.Inbound.inbound() *", in
0820:                                .readLine());
0821:
0822:                assertEquals("End of file", null, in.readLine());
0823:            }
0824:
0825:            public void testSetFlagInferredToFalse() throws IOException {
0826:                factory.createPackage("outbound").addDependency(
0827:                        factory.createPackage("inbound"));
0828:                factory.createClass("outbound.Outbound").addDependency(
0829:                        factory.createClass("inbound.Inbound"));
0830:                factory
0831:                        .createFeature("outbound.Outbound.outbound()")
0832:                        .addDependency(
0833:                                factory
0834:                                        .createFeature("inbound.Inbound.inbound()"));
0835:                factory.createPackage("empty");
0836:
0837:                visitor.setShowInferred(false);
0838:
0839:                visitor.traverseNodes(factory.getPackages().values());
0840:
0841:                int lineNumber = 0;
0842:                BufferedReader in = new BufferedReader(new StringReader(out
0843:                        .toString()));
0844:
0845:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0846:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0847:                assertEquals("line " + ++lineNumber, "    <-- outbound", in
0848:                        .readLine());
0849:                assertEquals("line " + ++lineNumber, "    Inbound", in
0850:                        .readLine());
0851:                assertEquals("line " + ++lineNumber,
0852:                        "        <-- outbound.Outbound", in.readLine());
0853:                assertEquals("line " + ++lineNumber, "        inbound()", in
0854:                        .readLine());
0855:                assertEquals("line " + ++lineNumber,
0856:                        "            <-- outbound.Outbound.outbound()", in
0857:                                .readLine());
0858:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0859:                assertEquals("line " + ++lineNumber, "    --> inbound", in
0860:                        .readLine());
0861:                assertEquals("line " + ++lineNumber, "    Outbound", in
0862:                        .readLine());
0863:                assertEquals("line " + ++lineNumber,
0864:                        "        --> inbound.Inbound", in.readLine());
0865:                assertEquals("line " + ++lineNumber, "        outbound()", in
0866:                        .readLine());
0867:                assertEquals("line " + ++lineNumber,
0868:                        "            --> inbound.Inbound.inbound()", in
0869:                                .readLine());
0870:
0871:                assertEquals("End of file", null, in.readLine());
0872:            }
0873:
0874:            public void testShowEmptyPackageTrueWithConfirmed()
0875:                    throws IOException {
0876:                factory.createPackage("outbound", true).addDependency(
0877:                        factory.createPackage("inbound", true));
0878:                factory.createClass("outbound.Outbound", true).addDependency(
0879:                        factory.createClass("inbound.Inbound", true));
0880:                factory.createFeature("outbound.Outbound.outbound()", true)
0881:                        .addDependency(
0882:                                factory.createFeature(
0883:                                        "inbound.Inbound.inbound()", true));
0884:                factory.createPackage("empty", true);
0885:
0886:                visitor.setShowEmptyNodes(true);
0887:
0888:                visitor.traverseNodes(factory.getPackages().values());
0889:
0890:                int lineNumber = 0;
0891:                BufferedReader in = new BufferedReader(new StringReader(out
0892:                        .toString()));
0893:
0894:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
0895:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0896:                assertEquals("line " + ++lineNumber, "    <-- outbound", in
0897:                        .readLine());
0898:                assertEquals("line " + ++lineNumber, "    Inbound", in
0899:                        .readLine());
0900:                assertEquals("line " + ++lineNumber,
0901:                        "        <-- outbound.Outbound", in.readLine());
0902:                assertEquals("line " + ++lineNumber, "        inbound()", in
0903:                        .readLine());
0904:                assertEquals("line " + ++lineNumber,
0905:                        "            <-- outbound.Outbound.outbound()", in
0906:                                .readLine());
0907:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
0908:                assertEquals("line " + ++lineNumber, "    --> inbound", in
0909:                        .readLine());
0910:                assertEquals("line " + ++lineNumber, "    Outbound", in
0911:                        .readLine());
0912:                assertEquals("line " + ++lineNumber,
0913:                        "        --> inbound.Inbound", in.readLine());
0914:                assertEquals("line " + ++lineNumber, "        outbound()", in
0915:                        .readLine());
0916:                assertEquals("line " + ++lineNumber,
0917:                        "            --> inbound.Inbound.inbound()", in
0918:                                .readLine());
0919:
0920:                assertEquals("End of file", null, in.readLine());
0921:            }
0922:
0923:            public void testShowEmptyPackageFalseWithInferred()
0924:                    throws IOException {
0925:                factory.createPackage("outbound").addDependency(
0926:                        factory.createPackage("inbound"));
0927:                factory.createClass("outbound.Outbound").addDependency(
0928:                        factory.createClass("inbound.Inbound"));
0929:                factory
0930:                        .createFeature("outbound.Outbound.outbound()")
0931:                        .addDependency(
0932:                                factory
0933:                                        .createFeature("inbound.Inbound.inbound()"));
0934:                factory.createPackage("empty");
0935:
0936:                visitor.setShowEmptyNodes(false);
0937:
0938:                visitor.traverseNodes(factory.getPackages().values());
0939:
0940:                int lineNumber = 0;
0941:                BufferedReader in = new BufferedReader(new StringReader(out
0942:                        .toString()));
0943:
0944:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
0945:                assertEquals("line " + ++lineNumber, "    <-- outbound *", in
0946:                        .readLine());
0947:                assertEquals("line " + ++lineNumber, "    Inbound *", in
0948:                        .readLine());
0949:                assertEquals("line " + ++lineNumber,
0950:                        "        <-- outbound.Outbound *", in.readLine());
0951:                assertEquals("line " + ++lineNumber, "        inbound() *", in
0952:                        .readLine());
0953:                assertEquals("line " + ++lineNumber,
0954:                        "            <-- outbound.Outbound.outbound() *", in
0955:                                .readLine());
0956:                assertEquals("line " + ++lineNumber, "outbound *", in
0957:                        .readLine());
0958:                assertEquals("line " + ++lineNumber, "    --> inbound *", in
0959:                        .readLine());
0960:                assertEquals("line " + ++lineNumber, "    Outbound *", in
0961:                        .readLine());
0962:                assertEquals("line " + ++lineNumber,
0963:                        "        --> inbound.Inbound *", in.readLine());
0964:                assertEquals("line " + ++lineNumber, "        outbound() *", in
0965:                        .readLine());
0966:                assertEquals("line " + ++lineNumber,
0967:                        "            --> inbound.Inbound.inbound() *", in
0968:                                .readLine());
0969:
0970:                assertEquals("End of file", null, in.readLine());
0971:            }
0972:
0973:            public void testShowEmptyPackageFalseWithConfirmed()
0974:                    throws IOException {
0975:                factory.createPackage("outbound", true).addDependency(
0976:                        factory.createPackage("inbound", true));
0977:                factory.createClass("outbound.Outbound", true).addDependency(
0978:                        factory.createClass("inbound.Inbound", true));
0979:                factory.createFeature("outbound.Outbound.outbound()", true)
0980:                        .addDependency(
0981:                                factory.createFeature(
0982:                                        "inbound.Inbound.inbound()", true));
0983:                factory.createPackage("empty", true);
0984:
0985:                visitor.setShowEmptyNodes(false);
0986:
0987:                visitor.traverseNodes(factory.getPackages().values());
0988:
0989:                int lineNumber = 0;
0990:                BufferedReader in = new BufferedReader(new StringReader(out
0991:                        .toString()));
0992:
0993:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
0994:                assertEquals("line " + ++lineNumber, "    <-- outbound", in
0995:                        .readLine());
0996:                assertEquals("line " + ++lineNumber, "    Inbound", in
0997:                        .readLine());
0998:                assertEquals("line " + ++lineNumber,
0999:                        "        <-- outbound.Outbound", in.readLine());
1000:                assertEquals("line " + ++lineNumber, "        inbound()", in
1001:                        .readLine());
1002:                assertEquals("line " + ++lineNumber,
1003:                        "            <-- outbound.Outbound.outbound()", in
1004:                                .readLine());
1005:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
1006:                assertEquals("line " + ++lineNumber, "    --> inbound", in
1007:                        .readLine());
1008:                assertEquals("line " + ++lineNumber, "    Outbound", in
1009:                        .readLine());
1010:                assertEquals("line " + ++lineNumber,
1011:                        "        --> inbound.Inbound", in.readLine());
1012:                assertEquals("line " + ++lineNumber, "        outbound()", in
1013:                        .readLine());
1014:                assertEquals("line " + ++lineNumber,
1015:                        "            --> inbound.Inbound.inbound()", in
1016:                                .readLine());
1017:
1018:                assertEquals("End of file", null, in.readLine());
1019:            }
1020:
1021:            public void testShowEmptyClassTrueWithInferred() throws IOException {
1022:                factory.createClass("outbound.Outbound").addDependency(
1023:                        factory.createClass("inbound.Inbound"));
1024:                factory
1025:                        .createFeature("outbound.Outbound.outbound()")
1026:                        .addDependency(
1027:                                factory
1028:                                        .createFeature("inbound.Inbound.inbound()"));
1029:                factory.createClass("empty.Empty");
1030:
1031:                visitor.setShowEmptyNodes(true);
1032:
1033:                visitor.traverseNodes(factory.getPackages().values());
1034:
1035:                int lineNumber = 0;
1036:                BufferedReader in = new BufferedReader(new StringReader(out
1037:                        .toString()));
1038:
1039:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
1040:                assertEquals("line " + ++lineNumber, "    Empty *", in
1041:                        .readLine());
1042:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
1043:                assertEquals("line " + ++lineNumber, "    Inbound *", in
1044:                        .readLine());
1045:                assertEquals("line " + ++lineNumber,
1046:                        "        <-- outbound.Outbound *", in.readLine());
1047:                assertEquals("line " + ++lineNumber, "        inbound() *", in
1048:                        .readLine());
1049:                assertEquals("line " + ++lineNumber,
1050:                        "            <-- outbound.Outbound.outbound() *", in
1051:                                .readLine());
1052:                assertEquals("line " + ++lineNumber, "outbound *", in
1053:                        .readLine());
1054:                assertEquals("line " + ++lineNumber, "    Outbound *", in
1055:                        .readLine());
1056:                assertEquals("line " + ++lineNumber,
1057:                        "        --> inbound.Inbound *", in.readLine());
1058:                assertEquals("line " + ++lineNumber, "        outbound() *", in
1059:                        .readLine());
1060:                assertEquals("line " + ++lineNumber,
1061:                        "            --> inbound.Inbound.inbound() *", in
1062:                                .readLine());
1063:
1064:                assertEquals("End of file", null, in.readLine());
1065:            }
1066:
1067:            public void testShowEmptyClassTrueWithConfirmed()
1068:                    throws IOException {
1069:                factory.createClass("outbound.Outbound", true).addDependency(
1070:                        factory.createClass("inbound.Inbound", true));
1071:                factory.createFeature("outbound.Outbound.outbound()", true)
1072:                        .addDependency(
1073:                                factory.createFeature(
1074:                                        "inbound.Inbound.inbound()", true));
1075:                factory.createClass("empty.Empty", true);
1076:
1077:                visitor.setShowEmptyNodes(true);
1078:
1079:                visitor.traverseNodes(factory.getPackages().values());
1080:
1081:                int lineNumber = 0;
1082:                BufferedReader in = new BufferedReader(new StringReader(out
1083:                        .toString()));
1084:
1085:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
1086:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
1087:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
1088:                assertEquals("line " + ++lineNumber, "    Inbound", in
1089:                        .readLine());
1090:                assertEquals("line " + ++lineNumber,
1091:                        "        <-- outbound.Outbound", in.readLine());
1092:                assertEquals("line " + ++lineNumber, "        inbound()", in
1093:                        .readLine());
1094:                assertEquals("line " + ++lineNumber,
1095:                        "            <-- outbound.Outbound.outbound()", in
1096:                                .readLine());
1097:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
1098:                assertEquals("line " + ++lineNumber, "    Outbound", in
1099:                        .readLine());
1100:                assertEquals("line " + ++lineNumber,
1101:                        "        --> inbound.Inbound", in.readLine());
1102:                assertEquals("line " + ++lineNumber, "        outbound()", in
1103:                        .readLine());
1104:                assertEquals("line " + ++lineNumber,
1105:                        "            --> inbound.Inbound.inbound()", in
1106:                                .readLine());
1107:
1108:                assertEquals("End of file", null, in.readLine());
1109:            }
1110:
1111:            public void testShowEmptyClassFalseWithInferred()
1112:                    throws IOException {
1113:                factory.createClass("outbound.Outbound").addDependency(
1114:                        factory.createClass("inbound.Inbound"));
1115:                factory
1116:                        .createFeature("outbound.Outbound.outbound()")
1117:                        .addDependency(
1118:                                factory
1119:                                        .createFeature("inbound.Inbound.inbound()"));
1120:                factory.createClass("empty.Empty");
1121:
1122:                visitor.setShowEmptyNodes(false);
1123:
1124:                visitor.traverseNodes(factory.getPackages().values());
1125:
1126:                int lineNumber = 0;
1127:                BufferedReader in = new BufferedReader(new StringReader(out
1128:                        .toString()));
1129:
1130:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
1131:                assertEquals("line " + ++lineNumber, "    Inbound *", in
1132:                        .readLine());
1133:                assertEquals("line " + ++lineNumber,
1134:                        "        <-- outbound.Outbound *", in.readLine());
1135:                assertEquals("line " + ++lineNumber, "        inbound() *", in
1136:                        .readLine());
1137:                assertEquals("line " + ++lineNumber,
1138:                        "            <-- outbound.Outbound.outbound() *", in
1139:                                .readLine());
1140:                assertEquals("line " + ++lineNumber, "outbound *", in
1141:                        .readLine());
1142:                assertEquals("line " + ++lineNumber, "    Outbound *", in
1143:                        .readLine());
1144:                assertEquals("line " + ++lineNumber,
1145:                        "        --> inbound.Inbound *", in.readLine());
1146:                assertEquals("line " + ++lineNumber, "        outbound() *", in
1147:                        .readLine());
1148:                assertEquals("line " + ++lineNumber,
1149:                        "            --> inbound.Inbound.inbound() *", in
1150:                                .readLine());
1151:
1152:                assertEquals("End of file", null, in.readLine());
1153:            }
1154:
1155:            public void testShowEmptyClassFalseWithConfirmed()
1156:                    throws IOException {
1157:                factory.createClass("outbound.Outbound", true).addDependency(
1158:                        factory.createClass("inbound.Inbound", true));
1159:                factory.createFeature("outbound.Outbound.outbound()", true)
1160:                        .addDependency(
1161:                                factory.createFeature(
1162:                                        "inbound.Inbound.inbound()", true));
1163:                factory.createClass("empty.Empty", true);
1164:
1165:                visitor.setShowEmptyNodes(false);
1166:
1167:                visitor.traverseNodes(factory.getPackages().values());
1168:
1169:                int lineNumber = 0;
1170:                BufferedReader in = new BufferedReader(new StringReader(out
1171:                        .toString()));
1172:
1173:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
1174:                assertEquals("line " + ++lineNumber, "    Inbound", in
1175:                        .readLine());
1176:                assertEquals("line " + ++lineNumber,
1177:                        "        <-- outbound.Outbound", in.readLine());
1178:                assertEquals("line " + ++lineNumber, "        inbound()", in
1179:                        .readLine());
1180:                assertEquals("line " + ++lineNumber,
1181:                        "            <-- outbound.Outbound.outbound()", in
1182:                                .readLine());
1183:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
1184:                assertEquals("line " + ++lineNumber, "    Outbound", in
1185:                        .readLine());
1186:                assertEquals("line " + ++lineNumber,
1187:                        "        --> inbound.Inbound", in.readLine());
1188:                assertEquals("line " + ++lineNumber, "        outbound()", in
1189:                        .readLine());
1190:                assertEquals("line " + ++lineNumber,
1191:                        "            --> inbound.Inbound.inbound()", in
1192:                                .readLine());
1193:
1194:                assertEquals("End of file", null, in.readLine());
1195:            }
1196:
1197:            public void testShowEmptyFeatureTrueWithInferred()
1198:                    throws IOException {
1199:                factory
1200:                        .createFeature("outbound.Outbound.outbound()")
1201:                        .addDependency(
1202:                                factory
1203:                                        .createFeature("inbound.Inbound.inbound()"));
1204:                factory.createFeature("empty.Empty.empty()");
1205:
1206:                visitor.setShowEmptyNodes(true);
1207:
1208:                visitor.traverseNodes(factory.getPackages().values());
1209:
1210:                int lineNumber = 0;
1211:                BufferedReader in = new BufferedReader(new StringReader(out
1212:                        .toString()));
1213:
1214:                assertEquals("line " + ++lineNumber, "empty *", in.readLine());
1215:                assertEquals("line " + ++lineNumber, "    Empty *", in
1216:                        .readLine());
1217:                assertEquals("line " + ++lineNumber, "        empty() *", in
1218:                        .readLine());
1219:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
1220:                assertEquals("line " + ++lineNumber, "    Inbound *", in
1221:                        .readLine());
1222:                assertEquals("line " + ++lineNumber, "        inbound() *", in
1223:                        .readLine());
1224:                assertEquals("line " + ++lineNumber,
1225:                        "            <-- outbound.Outbound.outbound() *", in
1226:                                .readLine());
1227:                assertEquals("line " + ++lineNumber, "outbound *", in
1228:                        .readLine());
1229:                assertEquals("line " + ++lineNumber, "    Outbound *", in
1230:                        .readLine());
1231:                assertEquals("line " + ++lineNumber, "        outbound() *", in
1232:                        .readLine());
1233:                assertEquals("line " + ++lineNumber,
1234:                        "            --> inbound.Inbound.inbound() *", in
1235:                                .readLine());
1236:
1237:                assertEquals("End of file", null, in.readLine());
1238:            }
1239:
1240:            public void testShowEmptyFeatureTrueWithConfirmed()
1241:                    throws IOException {
1242:                factory.createFeature("outbound.Outbound.outbound()", true)
1243:                        .addDependency(
1244:                                factory.createFeature(
1245:                                        "inbound.Inbound.inbound()", true));
1246:                factory.createFeature("empty.Empty.empty()", true);
1247:
1248:                visitor.setShowEmptyNodes(true);
1249:
1250:                visitor.traverseNodes(factory.getPackages().values());
1251:
1252:                int lineNumber = 0;
1253:                BufferedReader in = new BufferedReader(new StringReader(out
1254:                        .toString()));
1255:
1256:                assertEquals("line " + ++lineNumber, "empty", in.readLine());
1257:                assertEquals("line " + ++lineNumber, "    Empty", in.readLine());
1258:                assertEquals("line " + ++lineNumber, "        empty()", in
1259:                        .readLine());
1260:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
1261:                assertEquals("line " + ++lineNumber, "    Inbound", in
1262:                        .readLine());
1263:                assertEquals("line " + ++lineNumber, "        inbound()", in
1264:                        .readLine());
1265:                assertEquals("line " + ++lineNumber,
1266:                        "            <-- outbound.Outbound.outbound()", in
1267:                                .readLine());
1268:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
1269:                assertEquals("line " + ++lineNumber, "    Outbound", in
1270:                        .readLine());
1271:                assertEquals("line " + ++lineNumber, "        outbound()", in
1272:                        .readLine());
1273:                assertEquals("line " + ++lineNumber,
1274:                        "            --> inbound.Inbound.inbound()", in
1275:                                .readLine());
1276:
1277:                assertEquals("End of file", null, in.readLine());
1278:            }
1279:
1280:            public void testShowEmptyFeatureFalseWithInferred()
1281:                    throws IOException {
1282:                factory
1283:                        .createFeature("outbound.Outbound.outbound()")
1284:                        .addDependency(
1285:                                factory
1286:                                        .createFeature("inbound.Inbound.inbound()"));
1287:                factory.createFeature("empty.Empty.empty()");
1288:
1289:                visitor.setShowEmptyNodes(false);
1290:
1291:                visitor.traverseNodes(factory.getPackages().values());
1292:
1293:                int lineNumber = 0;
1294:                BufferedReader in = new BufferedReader(new StringReader(out
1295:                        .toString()));
1296:
1297:                assertEquals("line " + ++lineNumber, "inbound *", in.readLine());
1298:                assertEquals("line " + ++lineNumber, "    Inbound *", in
1299:                        .readLine());
1300:                assertEquals("line " + ++lineNumber, "        inbound() *", in
1301:                        .readLine());
1302:                assertEquals("line " + ++lineNumber,
1303:                        "            <-- outbound.Outbound.outbound() *", in
1304:                                .readLine());
1305:                assertEquals("line " + ++lineNumber, "outbound *", in
1306:                        .readLine());
1307:                assertEquals("line " + ++lineNumber, "    Outbound *", in
1308:                        .readLine());
1309:                assertEquals("line " + ++lineNumber, "        outbound() *", in
1310:                        .readLine());
1311:                assertEquals("line " + ++lineNumber,
1312:                        "            --> inbound.Inbound.inbound() *", in
1313:                                .readLine());
1314:
1315:                assertEquals("End of file", null, in.readLine());
1316:            }
1317:
1318:            public void testShowEmptyFeatureFalseWithConfirmed()
1319:                    throws IOException {
1320:                factory.createFeature("outbound.Outbound.outbound()", true)
1321:                        .addDependency(
1322:                                factory.createFeature(
1323:                                        "inbound.Inbound.inbound()", true));
1324:                factory.createFeature("empty.Empty.empty()", true);
1325:
1326:                visitor.setShowEmptyNodes(false);
1327:
1328:                visitor.traverseNodes(factory.getPackages().values());
1329:
1330:                int lineNumber = 0;
1331:                BufferedReader in = new BufferedReader(new StringReader(out
1332:                        .toString()));
1333:
1334:                assertEquals("line " + ++lineNumber, "inbound", in.readLine());
1335:                assertEquals("line " + ++lineNumber, "    Inbound", in
1336:                        .readLine());
1337:                assertEquals("line " + ++lineNumber, "        inbound()", in
1338:                        .readLine());
1339:                assertEquals("line " + ++lineNumber,
1340:                        "            <-- outbound.Outbound.outbound()", in
1341:                                .readLine());
1342:                assertEquals("line " + ++lineNumber, "outbound", in.readLine());
1343:                assertEquals("line " + ++lineNumber, "    Outbound", in
1344:                        .readLine());
1345:                assertEquals("line " + ++lineNumber, "        outbound()", in
1346:                        .readLine());
1347:                assertEquals("line " + ++lineNumber,
1348:                        "            --> inbound.Inbound.inbound()", in
1349:                                .readLine());
1350:
1351:                assertEquals("End of file", null, in.readLine());
1352:            }
1353:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.