Source Code Cross Referenced for TestDeletingVisitor.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 junit.framework.*;
0036:
0037:        import org.apache.log4j.*;
0038:
0039:        public class TestDeletingVisitor extends TestCase {
0040:            private NodeFactory factory;
0041:            private DeletingVisitor visitor;
0042:
0043:            protected void setUp() throws Exception {
0044:                super .setUp();
0045:
0046:                Logger.getLogger(getClass()).debug("Begin " + getName());
0047:
0048:                factory = new NodeFactory();
0049:                visitor = new DeletingVisitor(factory);
0050:            }
0051:
0052:            protected void tearDown() throws Exception {
0053:                Logger.getLogger(getClass()).debug("End " + getName());
0054:
0055:                super .tearDown();
0056:            }
0057:
0058:            public void testCreation() {
0059:                assertSame("factory", factory, visitor.getFactory());
0060:            }
0061:
0062:            /**
0063:             *  <p>Deleting package really deletes it.</p>
0064:             *  
0065:             *  <pre>
0066:             *  a          <-- delete this
0067:             *  </pre>
0068:             *
0069:             *  <p>becomes:</p>
0070:             */
0071:            public void testAcceptEmptyPackage() {
0072:                PackageNode node = factory.createPackage("a", true);
0073:
0074:                assertTrue("Missing package key", factory.getPackages()
0075:                        .containsKey("a"));
0076:                assertTrue("Missing package value", factory.getPackages()
0077:                        .containsValue(node));
0078:                assertTrue("Package not concrete", node.isConfirmed());
0079:
0080:                node.accept(visitor);
0081:
0082:                assertFalse("Did not remove package key", factory.getPackages()
0083:                        .containsKey("a"));
0084:                assertFalse("Did not remove package value", factory
0085:                        .getPackages().containsValue(node));
0086:                assertFalse("Package is still concrete", node.isConfirmed());
0087:            }
0088:
0089:            /**
0090:             *  <p>Deleting package deletes its classes.</p>
0091:             *  
0092:             *  <pre>
0093:             *  a          <-- delete this
0094:             *  +-- A
0095:             *  </pre>
0096:             *
0097:             *  <p>becomes:</p>
0098:             */
0099:            public void testAcceptPackageWithClasses() {
0100:                ClassNode node = factory.createClass("a.A", true);
0101:
0102:                assertTrue("Missing package key", factory.getPackages()
0103:                        .containsKey("a"));
0104:                assertTrue("Missing package value", factory.getPackages()
0105:                        .containsValue(node.getPackageNode()));
0106:                assertTrue("Package not concrete", node.getPackageNode()
0107:                        .isConfirmed());
0108:                assertTrue("Package node does not contain class node", node
0109:                        .getPackageNode().getClasses().contains(node));
0110:
0111:                assertTrue("Missing class key", factory.getClasses()
0112:                        .containsKey("a.A"));
0113:                assertTrue("Missing class value", factory.getClasses()
0114:                        .containsValue(node));
0115:                assertTrue("Class not concrete", node.isConfirmed());
0116:
0117:                node.getPackageNode().accept(visitor);
0118:
0119:                assertFalse("Did not remove package key", factory.getPackages()
0120:                        .containsKey("a"));
0121:                assertFalse("Did not remove package value", factory
0122:                        .getPackages().containsValue(node.getPackageNode()));
0123:                assertFalse("Package is still concrete", node.getPackageNode()
0124:                        .isConfirmed());
0125:                assertFalse("Package node still contains class node", node
0126:                        .getPackageNode().getClasses().contains(node));
0127:
0128:                assertFalse("Did not remove class key", factory.getClasses()
0129:                        .containsKey("a.A"));
0130:                assertFalse("Did not remove class value", factory.getClasses()
0131:                        .containsValue(node));
0132:                assertFalse("Class is still concrete", node.isConfirmed());
0133:            }
0134:
0135:            /**
0136:             *  <p>Deleting class preserves package and siblings.</p>
0137:             *  
0138:             *  <pre>
0139:             *  a
0140:             *  +-- A      <-- delete this
0141:             *  +-- B
0142:             *  </pre>
0143:             *
0144:             *  <p>becomes:</p>
0145:             *  
0146:             *  <pre>
0147:             *  a
0148:             *  +-- B
0149:             *  </pre>
0150:             */
0151:            public void testAcceptEmptyClass() {
0152:                ClassNode node1 = factory.createClass("a.A", true);
0153:                ClassNode node2 = factory.createClass("a.B", true);
0154:
0155:                assertTrue("Missing package key", factory.getPackages()
0156:                        .containsKey("a"));
0157:                assertTrue("Missing package value", factory.getPackages()
0158:                        .containsValue(node1.getPackageNode()));
0159:                assertTrue("Package not concrete", node1.getPackageNode()
0160:                        .isConfirmed());
0161:                assertTrue("Package node does not contain class node", node1
0162:                        .getPackageNode().getClasses().contains(node1));
0163:                assertTrue("Package node does not contain class node", node2
0164:                        .getPackageNode().getClasses().contains(node2));
0165:                assertSame("Classes have different package", node1
0166:                        .getPackageNode(), node2.getPackageNode());
0167:
0168:                assertTrue("Missing class key", factory.getClasses()
0169:                        .containsKey("a.A"));
0170:                assertTrue("Missing class value", factory.getClasses()
0171:                        .containsValue(node1));
0172:                assertTrue("Class not concrete", node1.isConfirmed());
0173:
0174:                node1.accept(visitor);
0175:
0176:                assertTrue("Missing package key", factory.getPackages()
0177:                        .containsKey("a"));
0178:                assertTrue("Missing package value", factory.getPackages()
0179:                        .containsValue(node1.getPackageNode()));
0180:                assertTrue("Package not concrete", node1.getPackageNode()
0181:                        .isConfirmed());
0182:                assertFalse("Package node still contains class node", node1
0183:                        .getPackageNode().getClasses().contains(node1));
0184:                assertTrue("Package node does not contain class node", node2
0185:                        .getPackageNode().getClasses().contains(node2));
0186:                assertSame("Classes have different package", node1
0187:                        .getPackageNode(), node2.getPackageNode());
0188:
0189:                assertFalse("Did not remove class key", factory.getClasses()
0190:                        .containsKey("a.A"));
0191:                assertFalse("Did not remove class value", factory.getClasses()
0192:                        .containsValue(node1));
0193:                assertFalse("Class is still concrete", node1.isConfirmed());
0194:            }
0195:
0196:            /**
0197:             *  <p>Deleting single class deletes its package.</p>
0198:             *  
0199:             *  <pre>
0200:             *  a
0201:             *  +-- A      <-- delete this
0202:             *  </pre>
0203:             *
0204:             *  <p>becomes:</p>
0205:             */
0206:            public void testAcceptSingleEmptyClass() {
0207:                ClassNode node = factory.createClass("a.A", true);
0208:
0209:                assertTrue("Missing package key", factory.getPackages()
0210:                        .containsKey("a"));
0211:                assertTrue("Missing package value", factory.getPackages()
0212:                        .containsValue(node.getPackageNode()));
0213:                assertTrue("Package not concrete", node.getPackageNode()
0214:                        .isConfirmed());
0215:                assertTrue("Package node does not contain class node", node
0216:                        .getPackageNode().getClasses().contains(node));
0217:
0218:                assertTrue("Missing class key", factory.getClasses()
0219:                        .containsKey("a.A"));
0220:                assertTrue("Missing class value", factory.getClasses()
0221:                        .containsValue(node));
0222:                assertTrue("Class not concrete", node.isConfirmed());
0223:
0224:                node.accept(visitor);
0225:
0226:                assertFalse("Did not remove package key", factory.getPackages()
0227:                        .containsKey("a"));
0228:                assertFalse("Did not remove package value", factory
0229:                        .getPackages().containsValue(node.getPackageNode()));
0230:                assertFalse("Package is still concrete", node.getPackageNode()
0231:                        .isConfirmed());
0232:                assertFalse("Package node still contains class node", node
0233:                        .getPackageNode().getClasses().contains(node));
0234:
0235:                assertFalse("Did not remove class key", factory.getClasses()
0236:                        .containsKey("a.A"));
0237:                assertFalse("Did not remove class value", factory.getClasses()
0238:                        .containsValue(node));
0239:                assertFalse("Class is still concrete", node.isConfirmed());
0240:            }
0241:
0242:            /**
0243:             *  <p>Deleting class deletes its features and preserves package and siblings.</p>
0244:             *  
0245:             *  <pre>
0246:             *  a
0247:             *  +-- A      <-- delete this
0248:             *  |   +-- a
0249:             *  +-- B
0250:             *  </pre>
0251:             *
0252:             *  <p>becomes:</p>
0253:             *  
0254:             *  <pre>
0255:             *  a
0256:             *  +-- B
0257:             *  </pre>
0258:             */
0259:            public void testAcceptClassWithFeature() {
0260:                FeatureNode node1 = factory.createFeature("a.A.a", true);
0261:                ClassNode node2 = factory.createClass("a.B", true);
0262:
0263:                assertTrue("Missing package key", factory.getPackages()
0264:                        .containsKey("a"));
0265:                assertTrue("Missing package value", factory.getPackages()
0266:                        .containsValue(node1.getClassNode().getPackageNode()));
0267:                assertTrue("Package not concrete", node1.getClassNode()
0268:                        .getPackageNode().isConfirmed());
0269:                assertTrue("Package node does not contain class node", node1
0270:                        .getClassNode().getPackageNode().getClasses().contains(
0271:                                node1.getClassNode()));
0272:                assertTrue("Package node does not contain class node", node2
0273:                        .getPackageNode().getClasses().contains(node2));
0274:
0275:                assertTrue("Missing class key", factory.getClasses()
0276:                        .containsKey("a.A"));
0277:                assertTrue("Missing class value", factory.getClasses()
0278:                        .containsValue(node1.getClassNode()));
0279:                assertTrue("Class not concrete", node1.getClassNode()
0280:                        .isConfirmed());
0281:                assertTrue("Class node does not contain feature node", node1
0282:                        .getClassNode().getFeatures().contains(node1));
0283:
0284:                assertTrue("Missing feature key", factory.getFeatures()
0285:                        .containsKey("a.A.a"));
0286:                assertTrue("Missing feature value", factory.getFeatures()
0287:                        .containsValue(node1));
0288:                assertTrue("Feature not concrete", node1.isConfirmed());
0289:
0290:                node1.getClassNode().accept(visitor);
0291:
0292:                assertTrue("Missing package key", factory.getPackages()
0293:                        .containsKey("a"));
0294:                assertTrue("Missing package value", factory.getPackages()
0295:                        .containsValue(node1.getClassNode().getPackageNode()));
0296:                assertTrue("Package not concrete", node1.getClassNode()
0297:                        .getPackageNode().isConfirmed());
0298:                assertFalse("Package node still contains class node", node1
0299:                        .getClassNode().getPackageNode().getClasses().contains(
0300:                                node1));
0301:                assertTrue("Package node does not contain class node", node2
0302:                        .getPackageNode().getClasses().contains(node2));
0303:
0304:                assertFalse("Did not remove class key", factory.getClasses()
0305:                        .containsKey("a.A"));
0306:                assertFalse("Did not remove class value", factory.getClasses()
0307:                        .containsValue(node1.getClassNode()));
0308:                assertFalse("Class is still concrete", node1.getClassNode()
0309:                        .isConfirmed());
0310:                assertFalse("Class node still contains feature node", node1
0311:                        .getClassNode().getFeatures().contains(node1));
0312:
0313:                assertFalse("Did not remove feature key", factory.getFeatures()
0314:                        .containsKey("a.A.a"));
0315:                assertFalse("Did not remove feature value", factory
0316:                        .getFeatures().containsValue(node1));
0317:                assertFalse("Feature is still concrete", node1.isConfirmed());
0318:            }
0319:
0320:            /**
0321:             *  <p>Deleting single class deletes its features and its package.</p>
0322:             *  
0323:             *  <pre>
0324:             *  a
0325:             *  +-- A      <-- delete this
0326:             *      +-- a
0327:             *  </pre>
0328:             *
0329:             *  <p>becomes:</p>
0330:             */
0331:            public void testAcceptSingleClassWithFeature() {
0332:                FeatureNode node1 = factory.createFeature("a.A.a", true);
0333:
0334:                assertTrue("Missing package key", factory.getPackages()
0335:                        .containsKey("a"));
0336:                assertTrue("Missing package value", factory.getPackages()
0337:                        .containsValue(node1.getClassNode().getPackageNode()));
0338:                assertTrue("Package not concrete", node1.getClassNode()
0339:                        .getPackageNode().isConfirmed());
0340:                assertTrue("Package node does not contain class node", node1
0341:                        .getClassNode().getPackageNode().getClasses().contains(
0342:                                node1.getClassNode()));
0343:
0344:                assertTrue("Missing class key", factory.getClasses()
0345:                        .containsKey("a.A"));
0346:                assertTrue("Missing class value", factory.getClasses()
0347:                        .containsValue(node1.getClassNode()));
0348:                assertTrue("Class not concrete", node1.getClassNode()
0349:                        .isConfirmed());
0350:                assertTrue("Class node does not contain feature node", node1
0351:                        .getClassNode().getFeatures().contains(node1));
0352:
0353:                assertTrue("Missing feature key", factory.getFeatures()
0354:                        .containsKey("a.A.a"));
0355:                assertTrue("Missing feature value", factory.getFeatures()
0356:                        .containsValue(node1));
0357:                assertTrue("Feature not concrete", node1.isConfirmed());
0358:
0359:                node1.getClassNode().accept(visitor);
0360:
0361:                assertFalse("Did not remove package key", factory.getPackages()
0362:                        .containsKey("a"));
0363:                assertFalse("Did not remove package value", factory
0364:                        .getPackages().containsValue(
0365:                                node1.getClassNode().getPackageNode()));
0366:                assertFalse("Package is still concrete", node1.getClassNode()
0367:                        .getPackageNode().isConfirmed());
0368:                assertFalse("Package node still contains class node", node1
0369:                        .getClassNode().getPackageNode().getClasses().contains(
0370:                                node1));
0371:
0372:                assertFalse("Did not remove class key", factory.getClasses()
0373:                        .containsKey("a.A"));
0374:                assertFalse("Did not remove class value", factory.getClasses()
0375:                        .containsValue(node1.getClassNode()));
0376:                assertFalse("Class is still concrete", node1.getClassNode()
0377:                        .isConfirmed());
0378:                assertFalse("Class node still contains feature node", node1
0379:                        .getClassNode().getFeatures().contains(node1));
0380:
0381:                assertFalse("Did not remove feature key", factory.getFeatures()
0382:                        .containsKey("a.A.a"));
0383:                assertFalse("Did not remove feature value", factory
0384:                        .getFeatures().containsValue(node1));
0385:                assertFalse("Feature is still concrete", node1.isConfirmed());
0386:            }
0387:
0388:            /**
0389:             *  <p>Deleting feature preserves class and siblings.</p>
0390:             *  
0391:             *  <pre>
0392:             *  a
0393:             *  +-- A
0394:             *      +-- a  <-- delete this
0395:             *      +-- b
0396:             *  </pre>
0397:             *
0398:             *  <p>becomes:</p>
0399:             *  
0400:             *  <pre>
0401:             *  a
0402:             *  +-- A
0403:             *      +-- b
0404:             *  </pre>
0405:             */
0406:            public void testAcceptEmptyFeature() {
0407:                FeatureNode node1 = factory.createFeature("a.A.a", true);
0408:                FeatureNode node2 = factory.createFeature("a.A.b", true);
0409:
0410:                assertTrue("Missing package key", factory.getPackages()
0411:                        .containsKey("a"));
0412:                assertTrue("Missing package value", factory.getPackages()
0413:                        .containsValue(node1.getClassNode().getPackageNode()));
0414:                assertTrue("Package not concrete", node1.getClassNode()
0415:                        .getPackageNode().isConfirmed());
0416:                assertTrue("Package node does not contain class node", node1
0417:                        .getClassNode().getPackageNode().getClasses().contains(
0418:                                node1.getClassNode()));
0419:
0420:                assertTrue("Missing class key", factory.getClasses()
0421:                        .containsKey("a.A"));
0422:                assertTrue("Missing class value", factory.getClasses()
0423:                        .containsValue(node1.getClassNode()));
0424:                assertTrue("Class not concrete", node1.getClassNode()
0425:                        .isConfirmed());
0426:                assertTrue("Class node does not contain feature node", node1
0427:                        .getClassNode().getFeatures().contains(node1));
0428:                assertTrue("Class node does not contain feature node", node2
0429:                        .getClassNode().getFeatures().contains(node2));
0430:                assertSame("Features have different class", node1
0431:                        .getClassNode(), node2.getClassNode());
0432:
0433:                assertTrue("Missing feature key", factory.getFeatures()
0434:                        .containsKey("a.A.a"));
0435:                assertTrue("Missing feature value", factory.getFeatures()
0436:                        .containsValue(node1));
0437:                assertTrue("Feature not concrete", node1.isConfirmed());
0438:
0439:                node1.accept(visitor);
0440:
0441:                assertTrue("Missing package key", factory.getPackages()
0442:                        .containsKey("a"));
0443:                assertTrue("Missing package value", factory.getPackages()
0444:                        .containsValue(node1.getClassNode().getPackageNode()));
0445:                assertTrue("Package not concrete", node1.getClassNode()
0446:                        .getPackageNode().isConfirmed());
0447:                assertTrue("Package node does not contain class node", node1
0448:                        .getClassNode().getPackageNode().getClasses().contains(
0449:                                node1.getClassNode()));
0450:
0451:                assertTrue("Missing class key", factory.getClasses()
0452:                        .containsKey("a.A"));
0453:                assertTrue("Missing class value", factory.getClasses()
0454:                        .containsValue(node1.getClassNode()));
0455:                assertTrue("Class not concrete", node1.getClassNode()
0456:                        .isConfirmed());
0457:                assertFalse("Class node still contains feature node", node1
0458:                        .getClassNode().getFeatures().contains(node1));
0459:                assertTrue("Class node does not contain feature node", node2
0460:                        .getClassNode().getFeatures().contains(node2));
0461:                assertSame("Features have different class", node1
0462:                        .getClassNode(), node2.getClassNode());
0463:
0464:                assertFalse("Did not remove feature key", factory.getFeatures()
0465:                        .containsKey("a.A.a"));
0466:                assertFalse("Did not remove feature value", factory
0467:                        .getFeatures().containsValue(node1));
0468:                assertFalse("Feature is still concrete", node1.isConfirmed());
0469:            }
0470:
0471:            /**
0472:             *  <p>Deleting single feature of single class deletes entire package.</p>
0473:             *  
0474:             *  <pre>
0475:             *  a
0476:             *  +-- A
0477:             *      +-- a  <-- delete this
0478:             *  </pre>
0479:             *
0480:             *  <p>becomes:</p>
0481:             *  
0482:             *  <pre>
0483:             *  a
0484:             *  +-- A
0485:             *  </pre>
0486:             */
0487:            public void testAcceptSingleEmptyFeature() {
0488:                FeatureNode node = factory.createFeature("a.A.a", true);
0489:
0490:                assertTrue("Missing package key", factory.getPackages()
0491:                        .containsKey("a"));
0492:                assertTrue("Missing package value", factory.getPackages()
0493:                        .containsValue(node.getClassNode().getPackageNode()));
0494:                assertTrue("Package not concrete", node.getClassNode()
0495:                        .getPackageNode().isConfirmed());
0496:                assertTrue("Package node does not contain class node", node
0497:                        .getClassNode().getPackageNode().getClasses().contains(
0498:                                node.getClassNode()));
0499:
0500:                assertTrue("Missing class key", factory.getClasses()
0501:                        .containsKey("a.A"));
0502:                assertTrue("Missing class value", factory.getClasses()
0503:                        .containsValue(node.getClassNode()));
0504:                assertTrue("Class not concrete", node.getClassNode()
0505:                        .isConfirmed());
0506:                assertTrue("Class node does not contain feature node", node
0507:                        .getClassNode().getFeatures().contains(node));
0508:
0509:                assertTrue("Missing feature key", factory.getFeatures()
0510:                        .containsKey("a.A.a"));
0511:                assertTrue("Missing feature value", factory.getFeatures()
0512:                        .containsValue(node));
0513:                assertTrue("Feature not concrete", node.isConfirmed());
0514:
0515:                node.accept(visitor);
0516:
0517:                assertTrue("Removed package key", factory.getPackages()
0518:                        .containsKey("a"));
0519:                assertTrue("Removed package value", factory.getPackages()
0520:                        .containsValue(node.getClassNode().getPackageNode()));
0521:                assertTrue("Package is no longer concrete", node.getClassNode()
0522:                        .getPackageNode().isConfirmed());
0523:                assertTrue("Package node no longer contains class node", node
0524:                        .getClassNode().getPackageNode().getClasses().contains(
0525:                                node.getClassNode()));
0526:
0527:                assertTrue("Removed class key", factory.getClasses()
0528:                        .containsKey("a.A"));
0529:                assertTrue("Removed class value", factory.getClasses()
0530:                        .containsValue(node.getClassNode()));
0531:                assertTrue("Class is no longer concrete", node.getClassNode()
0532:                        .isConfirmed());
0533:                assertFalse("Class node still contains feature node", node
0534:                        .getClassNode().getFeatures().contains(node));
0535:
0536:                assertFalse("Did not remove feature key", factory.getFeatures()
0537:                        .containsKey("a.A.a"));
0538:                assertFalse("Did not remove feature value", factory
0539:                        .getFeatures().containsValue(node));
0540:                assertFalse("Feature is still concrete", node.isConfirmed());
0541:            }
0542:
0543:            /**
0544:             *  <p>Deleting package leaves other concrete packages intact.</p>
0545:             *  
0546:             *  <pre>
0547:             *  a          <-- delete this
0548:             *      <-- b
0549:             *  b
0550:             *      --> a
0551:             *  </pre>
0552:             *
0553:             *  <p>becomes:</p>
0554:             *  
0555:             *  <pre>
0556:             *  b
0557:             *  </pre>
0558:             */
0559:            public void testAcceptPackageWithDependencyOnConcretePackage() {
0560:                PackageNode a = factory.createPackage("a", true);
0561:                PackageNode b = factory.createPackage("b", true);
0562:
0563:                a.addDependency(b);
0564:
0565:                assertTrue("Missing package key a", factory.getPackages()
0566:                        .containsKey("a"));
0567:                assertTrue("Missing package value a", factory.getPackages()
0568:                        .containsValue(a));
0569:                assertTrue("Package a not concrete", a.isConfirmed());
0570:                assertTrue("a --> b is missing", a.getOutboundDependencies()
0571:                        .contains(b));
0572:
0573:                assertTrue("Missing package key b", factory.getPackages()
0574:                        .containsKey("b"));
0575:                assertTrue("Missing package value b", factory.getPackages()
0576:                        .containsValue(b));
0577:                assertTrue("Package b not concrete", b.isConfirmed());
0578:                assertTrue("b <-- a is missing", b.getInboundDependencies()
0579:                        .contains(a));
0580:
0581:                a.accept(visitor);
0582:
0583:                assertFalse("Did not remove package key a", factory
0584:                        .getPackages().containsKey("a"));
0585:                assertFalse("Did not remove package value a", factory
0586:                        .getPackages().containsValue(a));
0587:                assertFalse("Package a is still concrete", a.isConfirmed());
0588:                assertFalse("Did not remove a --> b", a
0589:                        .getOutboundDependencies().contains(b));
0590:
0591:                assertTrue("Removed package key b", factory.getPackages()
0592:                        .containsKey("b"));
0593:                assertTrue("Removed package value b", factory.getPackages()
0594:                        .containsValue(b));
0595:                assertTrue("Package b is no longer concrete", b.isConfirmed());
0596:                assertFalse("Did not remove b <-- a", b
0597:                        .getInboundDependencies().contains(a));
0598:            }
0599:
0600:            /**
0601:             *  <p>Deleting package removes obsolete non-concrete packages.</p>
0602:             *  
0603:             *  <pre>
0604:             *  a          <-- delete this
0605:             *      <-- b
0606:             *  b
0607:             *      --> a
0608:             *  </pre>
0609:             *
0610:             *  <p>becomes:</p>
0611:             */
0612:            public void testAcceptPackageWithDependencyOnNonConcretePackage() {
0613:                PackageNode a = factory.createPackage("a", true);
0614:                PackageNode b = factory.createPackage("b", false);
0615:
0616:                a.addDependency(b);
0617:
0618:                assertTrue("Missing package key a", factory.getPackages()
0619:                        .containsKey("a"));
0620:                assertTrue("Missing package value a", factory.getPackages()
0621:                        .containsValue(a));
0622:                assertTrue("Package a not concrete", a.isConfirmed());
0623:                assertTrue("a --> b is missing", a.getOutboundDependencies()
0624:                        .contains(b));
0625:
0626:                assertTrue("Missing package key b", factory.getPackages()
0627:                        .containsKey("b"));
0628:                assertTrue("Missing package value b", factory.getPackages()
0629:                        .containsValue(b));
0630:                assertFalse("Package b is concrete", b.isConfirmed());
0631:                assertTrue("b <-- a is missing", b.getInboundDependencies()
0632:                        .contains(a));
0633:
0634:                a.accept(visitor);
0635:
0636:                assertFalse("Did not remove package key a", factory
0637:                        .getPackages().containsKey("a"));
0638:                assertFalse("Did not remove package value a", factory
0639:                        .getPackages().containsValue(a));
0640:                assertFalse("Package a is still concrete", a.isConfirmed());
0641:                assertFalse("Did not remove a --> b", a
0642:                        .getOutboundDependencies().contains(b));
0643:
0644:                assertFalse("Did not remove package key b", factory
0645:                        .getPackages().containsKey("b"));
0646:                assertFalse("Did not remove package value b", factory
0647:                        .getPackages().containsValue(b));
0648:                assertFalse("Package b became concrete", b.isConfirmed());
0649:                assertFalse("Did not remove b <-- a", b
0650:                        .getInboundDependencies().contains(a));
0651:            }
0652:
0653:            /**
0654:             *  <p>Deleting class leaves other concrete classes intact.</p>
0655:             *  
0656:             *  <pre>
0657:             *  a
0658:             *  +-- A          <-- delete this
0659:             *          <-- b.B
0660:             *  b
0661:             *  +-- B
0662:             *          --> a.A
0663:             *  </pre>
0664:             *
0665:             *  <p>becomes:</p>
0666:             *  
0667:             *  <pre>
0668:             *  b
0669:             *  +-- B
0670:             *  </pre>
0671:             */
0672:            public void testAcceptClassWithDependencyOnConcreteClass() {
0673:                ClassNode a_A = factory.createClass("a.A", true);
0674:                ClassNode b_B = factory.createClass("b.B", true);
0675:
0676:                a_A.addDependency(b_B);
0677:
0678:                assertTrue("Missing package key a", factory.getPackages()
0679:                        .containsKey("a"));
0680:                assertTrue("Missing package value a", factory.getPackages()
0681:                        .containsValue(a_A.getPackageNode()));
0682:                assertTrue("Package a not concrete", a_A.getPackageNode()
0683:                        .isConfirmed());
0684:                assertTrue("Missing class key a.A", factory.getClasses()
0685:                        .containsKey("a.A"));
0686:                assertTrue("Missing class value a.A", factory.getClasses()
0687:                        .containsValue(a_A));
0688:                assertTrue("Class a.A not concrete", a_A.isConfirmed());
0689:                assertTrue("a.A --> b.B is missing", a_A
0690:                        .getOutboundDependencies().contains(b_B));
0691:
0692:                assertTrue("Missing package key b", factory.getPackages()
0693:                        .containsKey("b"));
0694:                assertTrue("Missing package value b", factory.getPackages()
0695:                        .containsValue(b_B.getPackageNode()));
0696:                assertTrue("Package b not concrete", b_B.getPackageNode()
0697:                        .isConfirmed());
0698:                assertTrue("Missing class key b.B", factory.getClasses()
0699:                        .containsKey("b.B"));
0700:                assertTrue("Missing class value b.B", factory.getClasses()
0701:                        .containsValue(b_B));
0702:                assertTrue("Class b.B not concrete", b_B.isConfirmed());
0703:                assertTrue("b.B <-- a.A is missing", b_B
0704:                        .getInboundDependencies().contains(a_A));
0705:
0706:                a_A.accept(visitor);
0707:
0708:                assertFalse("Did not remove package key a", factory
0709:                        .getPackages().containsKey("a"));
0710:                assertFalse("Did not remove package value a", factory
0711:                        .getPackages().containsValue(a_A.getPackageNode()));
0712:                assertFalse("Package a is still concrete", a_A.getPackageNode()
0713:                        .isConfirmed());
0714:                assertFalse("Did not remove class key a.A", factory
0715:                        .getClasses().containsKey("a.A"));
0716:                assertFalse("Did not remove class value a.A", factory
0717:                        .getClasses().containsValue(a_A));
0718:                assertFalse("Class a.A is still concrete", a_A.isConfirmed());
0719:                assertFalse("Did not remove a.A --> b.B", a_A
0720:                        .getOutboundDependencies().contains(b_B));
0721:
0722:                assertTrue("Removed package key b", factory.getPackages()
0723:                        .containsKey("b"));
0724:                assertTrue("Removed package value b", factory.getPackages()
0725:                        .containsValue(b_B.getPackageNode()));
0726:                assertTrue("Package b is no longer concrete", b_B.isConfirmed());
0727:                assertTrue("Removed class key b.B", factory.getClasses()
0728:                        .containsKey("b.B"));
0729:                assertTrue("Removed class value b.B", factory.getClasses()
0730:                        .containsValue(b_B));
0731:                assertTrue("Class b.B is no longer concrete", b_B.isConfirmed());
0732:                assertFalse("Did not remove b.B <-- a.A", b_B
0733:                        .getInboundDependencies().contains(a_A));
0734:            }
0735:
0736:            /**
0737:             *  <p>Deleting class removes other obsolete classes.</p>
0738:             *  
0739:             *  <pre>
0740:             *  a
0741:             *  +-- A          <-- delete this
0742:             *          <-- b.B
0743:             *  b
0744:             *  +-- B
0745:             *          --> a.A
0746:             *  </pre>
0747:             *
0748:             *  <p>becomes:</p>
0749:             */
0750:            public void testAcceptClassWithDependencyOnReferencedClass() {
0751:                ClassNode a_A = factory.createClass("a.A", true);
0752:                ClassNode b_B = factory.createClass("b.B", false);
0753:
0754:                a_A.addDependency(b_B);
0755:
0756:                assertTrue("Missing package key a", factory.getPackages()
0757:                        .containsKey("a"));
0758:                assertTrue("Missing package value a", factory.getPackages()
0759:                        .containsValue(a_A.getPackageNode()));
0760:                assertTrue("Package a not concrete", a_A.getPackageNode()
0761:                        .isConfirmed());
0762:                assertTrue("Missing class key a.A", factory.getClasses()
0763:                        .containsKey("a.A"));
0764:                assertTrue("Missing class value a.A", factory.getClasses()
0765:                        .containsValue(a_A));
0766:                assertTrue("Class a.A not concrete", a_A.isConfirmed());
0767:                assertTrue("a.A --> b.B is missing", a_A
0768:                        .getOutboundDependencies().contains(b_B));
0769:
0770:                assertTrue("Missing package key b", factory.getPackages()
0771:                        .containsKey("b"));
0772:                assertTrue("Missing package value b", factory.getPackages()
0773:                        .containsValue(b_B.getPackageNode()));
0774:                assertFalse("Package b is concrete", b_B.getPackageNode()
0775:                        .isConfirmed());
0776:                assertTrue("Missing class key b.B", factory.getClasses()
0777:                        .containsKey("b.B"));
0778:                assertTrue("Missing class value b.B", factory.getClasses()
0779:                        .containsValue(b_B));
0780:                assertFalse("Class b.B is concrete", b_B.isConfirmed());
0781:                assertTrue("b.B <-- a.A is missing", b_B
0782:                        .getInboundDependencies().contains(a_A));
0783:
0784:                a_A.accept(visitor);
0785:
0786:                assertFalse("Did not remove package key a", factory
0787:                        .getPackages().containsKey("a"));
0788:                assertFalse("Did not remove package value a", factory
0789:                        .getPackages().containsValue(a_A.getPackageNode()));
0790:                assertFalse("Package a is still concrete", a_A.getPackageNode()
0791:                        .isConfirmed());
0792:                assertFalse("Did not remove class key a.A", factory
0793:                        .getClasses().containsKey("a.A"));
0794:                assertFalse("Did not remove class value a.A", factory
0795:                        .getClasses().containsValue(a_A));
0796:                assertFalse("Class a.A is still concrete", a_A.isConfirmed());
0797:                assertFalse("Did not remove a.A --> b.B", a_A
0798:                        .getOutboundDependencies().contains(b_B));
0799:
0800:                assertFalse("Did not remove package key b", factory
0801:                        .getPackages().containsKey("b"));
0802:                assertFalse("Did not remove package value b", factory
0803:                        .getPackages().containsValue(b_B.getPackageNode()));
0804:                assertFalse("Package b is now concrete", b_B.getPackageNode()
0805:                        .isConfirmed());
0806:                assertFalse("Did not remove class key b.B", factory
0807:                        .getClasses().containsKey("b.B"));
0808:                assertFalse("Did not remove class value b.B", factory
0809:                        .getClasses().containsValue(b_B));
0810:                assertFalse("Class b.B is now concrete", b_B.isConfirmed());
0811:                assertFalse("Did not remove b.B <-- a.A", b_B
0812:                        .getInboundDependencies().contains(a_A));
0813:            }
0814:
0815:            /**
0816:             *  <p>Deleting class leaves other concrete features intact.</p>
0817:             *  
0818:             *  <pre>
0819:             *  a
0820:             *  +-- A           <-- delete this
0821:             *      +-- a
0822:             *              <-- b.B.b
0823:             *  b
0824:             *  +-- B
0825:             *      +-- b
0826:             *              --> a.A.a
0827:             *  </pre>
0828:             *
0829:             *  <p>becomes:</p>
0830:             *  
0831:             *  <pre>
0832:             *  b
0833:             *  +-- B
0834:             *      +-- b
0835:             *  </pre>
0836:             */
0837:            public void testAcceptClassWithFeatureWithDependencyOnConcreteFeature() {
0838:                FeatureNode a_A_a = factory.createFeature("a.A.a", true);
0839:                FeatureNode b_B_b = factory.createFeature("b.B.b", true);
0840:
0841:                a_A_a.addDependency(b_B_b);
0842:
0843:                assertTrue("Missing package key a", factory.getPackages()
0844:                        .containsKey("a"));
0845:                assertTrue("Missing package value a", factory.getPackages()
0846:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
0847:                assertTrue("Package a not concrete", a_A_a.getClassNode()
0848:                        .getPackageNode().isConfirmed());
0849:                assertTrue("Missing class key a.A", factory.getClasses()
0850:                        .containsKey("a.A"));
0851:                assertTrue("Missing class value a.A", factory.getClasses()
0852:                        .containsValue(a_A_a.getClassNode()));
0853:                assertTrue("Class a.A not concrete", a_A_a.getClassNode()
0854:                        .isConfirmed());
0855:                assertTrue("Missing feature key a.A.a", factory.getFeatures()
0856:                        .containsKey("a.A.a"));
0857:                assertTrue("Missing feature value a.A.a", factory.getFeatures()
0858:                        .containsValue(a_A_a));
0859:                assertTrue("Feature a.A.a not concrete", a_A_a.isConfirmed());
0860:                assertTrue("a.A.a --> b.B.b is missing", a_A_a
0861:                        .getOutboundDependencies().contains(b_B_b));
0862:
0863:                assertTrue("Missing package key b", factory.getPackages()
0864:                        .containsKey("b"));
0865:                assertTrue("Missing package value b", factory.getPackages()
0866:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
0867:                assertTrue("Package b not concrete", b_B_b.getClassNode()
0868:                        .getPackageNode().isConfirmed());
0869:                assertTrue("Missing class key b.B", factory.getClasses()
0870:                        .containsKey("b.B"));
0871:                assertTrue("Missing class value b.B", factory.getClasses()
0872:                        .containsValue(b_B_b.getClassNode()));
0873:                assertTrue("Class b.B not concrete", b_B_b.getClassNode()
0874:                        .isConfirmed());
0875:                assertTrue("Missing feature key b.B.b", factory.getFeatures()
0876:                        .containsKey("b.B.b"));
0877:                assertTrue("Missing feature value b.B.b", factory.getFeatures()
0878:                        .containsValue(b_B_b));
0879:                assertTrue("Feature b.B.b not concrete", b_B_b.isConfirmed());
0880:                assertTrue("b.B <-- a.A is missing", b_B_b
0881:                        .getInboundDependencies().contains(a_A_a));
0882:
0883:                a_A_a.getClassNode().accept(visitor);
0884:
0885:                assertFalse("Did not remove package key a", factory
0886:                        .getPackages().containsKey("a"));
0887:                assertFalse("Did not remove package value a", factory
0888:                        .getPackages().containsValue(
0889:                                a_A_a.getClassNode().getPackageNode()));
0890:                assertFalse("Package a is still concrete", a_A_a.getClassNode()
0891:                        .getPackageNode().isConfirmed());
0892:                assertFalse("Did not remove class key a.A", factory
0893:                        .getClasses().containsKey("a.A"));
0894:                assertFalse("Did not remove class value a.A", factory
0895:                        .getClasses().containsValue(a_A_a.getClassNode()));
0896:                assertFalse("Class a.A is still concrete", a_A_a.getClassNode()
0897:                        .isConfirmed());
0898:                assertFalse("Did not remove feature key a.A.a", factory
0899:                        .getFeatures().containsKey("a.A.a"));
0900:                assertFalse("Did not remove feature value a.A.a", factory
0901:                        .getFeatures().containsValue(a_A_a));
0902:                assertFalse("Feature a.A.a is still concrete", a_A_a
0903:                        .isConfirmed());
0904:                assertFalse("Did not remove a.A --> b.B", a_A_a
0905:                        .getOutboundDependencies().contains(b_B_b));
0906:
0907:                assertTrue("Removed package key b", factory.getPackages()
0908:                        .containsKey("b"));
0909:                assertTrue("Removed package value b", factory.getPackages()
0910:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
0911:                assertTrue("Package b is no longer concrete", b_B_b
0912:                        .getClassNode().getPackageNode().isConfirmed());
0913:                assertTrue("Removed class key b.B", factory.getClasses()
0914:                        .containsKey("b.B"));
0915:                assertTrue("Removed class value b.B", factory.getClasses()
0916:                        .containsValue(b_B_b.getClassNode()));
0917:                assertTrue("Class b.B is no longer concrete", b_B_b
0918:                        .getClassNode().isConfirmed());
0919:                assertTrue("Removed feature key b.B.b", factory.getFeatures()
0920:                        .containsKey("b.B.b"));
0921:                assertTrue("Removed feature value b.B.b", factory.getFeatures()
0922:                        .containsValue(b_B_b));
0923:                assertTrue("Feature b.B.b is no longer concrete", b_B_b
0924:                        .isConfirmed());
0925:                assertFalse("Did not remove b.B <-- a.A", b_B_b
0926:                        .getInboundDependencies().contains(a_A_a));
0927:            }
0928:
0929:            /**
0930:             *  <p>Deleting feature leaves other concrete features intact.</p>
0931:             *  
0932:             *  <pre>
0933:             *  a
0934:             *  +-- A
0935:             *      +-- a       <-- delete this
0936:             *              <-- b.B.b
0937:             *  b
0938:             *  +-- B
0939:             *      +-- b
0940:             *              --> a.A.a
0941:             *  </pre>
0942:             *
0943:             *  <p>becomes:</p>
0944:             *  
0945:             *  <pre>
0946:             *  a
0947:             *  +-- A
0948:             *  
0949:             *  b
0950:             *  +-- B
0951:             *      +-- b
0952:             *  </pre>
0953:             */
0954:            public void testAcceptFeatureWithDependencyOnConcreteFeature() {
0955:                FeatureNode a_A_a = factory.createFeature("a.A.a", true);
0956:                FeatureNode b_B_b = factory.createFeature("b.B.b", true);
0957:
0958:                a_A_a.addDependency(b_B_b);
0959:
0960:                assertTrue("Missing package key a", factory.getPackages()
0961:                        .containsKey("a"));
0962:                assertTrue("Missing package value a", factory.getPackages()
0963:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
0964:                assertTrue("Package a not concrete", a_A_a.getClassNode()
0965:                        .getPackageNode().isConfirmed());
0966:                assertTrue("Missing class key a.A", factory.getClasses()
0967:                        .containsKey("a.A"));
0968:                assertTrue("Missing class value a.A", factory.getClasses()
0969:                        .containsValue(a_A_a.getClassNode()));
0970:                assertTrue("Class a.A not concrete", a_A_a.getClassNode()
0971:                        .isConfirmed());
0972:                assertTrue("Missing feature key a.A.a", factory.getFeatures()
0973:                        .containsKey("a.A.a"));
0974:                assertTrue("Missing feature value a.A.a", factory.getFeatures()
0975:                        .containsValue(a_A_a));
0976:                assertTrue("Feature a.A.a not concrete", a_A_a.isConfirmed());
0977:                assertTrue("a.A.a --> b.B.b is missing", a_A_a
0978:                        .getOutboundDependencies().contains(b_B_b));
0979:
0980:                assertTrue("Missing package key b", factory.getPackages()
0981:                        .containsKey("b"));
0982:                assertTrue("Missing package value b", factory.getPackages()
0983:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
0984:                assertTrue("Package b not concrete", b_B_b.getClassNode()
0985:                        .getPackageNode().isConfirmed());
0986:                assertTrue("Missing class key b.B", factory.getClasses()
0987:                        .containsKey("b.B"));
0988:                assertTrue("Missing class value b.B", factory.getClasses()
0989:                        .containsValue(b_B_b.getClassNode()));
0990:                assertTrue("Class b.B not concrete", b_B_b.getClassNode()
0991:                        .isConfirmed());
0992:                assertTrue("Missing feature key b.B.b", factory.getFeatures()
0993:                        .containsKey("b.B.b"));
0994:                assertTrue("Missing feature value b.B.b", factory.getFeatures()
0995:                        .containsValue(b_B_b));
0996:                assertTrue("Feature b.B.b not concrete", b_B_b.isConfirmed());
0997:                assertTrue("b.B <-- a.A is missing", b_B_b
0998:                        .getInboundDependencies().contains(a_A_a));
0999:
1000:                a_A_a.accept(visitor);
1001:
1002:                assertTrue("Removed package key a", factory.getPackages()
1003:                        .containsKey("a"));
1004:                assertTrue("Removed package value a", factory.getPackages()
1005:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
1006:                assertTrue("Package a is no longer concrete", a_A_a
1007:                        .getClassNode().getPackageNode().isConfirmed());
1008:                assertTrue("Removed class key a.A", factory.getClasses()
1009:                        .containsKey("a.A"));
1010:                assertTrue("Removed class value a.A", factory.getClasses()
1011:                        .containsValue(a_A_a.getClassNode()));
1012:                assertTrue("Class a.A is no longer concrete", a_A_a
1013:                        .getClassNode().isConfirmed());
1014:                assertFalse("Did not remove feature key a.A.a", factory
1015:                        .getFeatures().containsKey("a.A.a"));
1016:                assertFalse("Did not remove feature value a.A.a", factory
1017:                        .getFeatures().containsValue(a_A_a));
1018:                assertFalse("Feature a.A.a is still concrete", a_A_a
1019:                        .isConfirmed());
1020:                assertFalse("Did not remove a.A --> b.B", a_A_a
1021:                        .getOutboundDependencies().contains(b_B_b));
1022:
1023:                assertTrue("Removed package key b", factory.getPackages()
1024:                        .containsKey("b"));
1025:                assertTrue("Removed package value b", factory.getPackages()
1026:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
1027:                assertTrue("Package b is no longer concrete", b_B_b
1028:                        .getClassNode().getPackageNode().isConfirmed());
1029:                assertTrue("Removed class key b.B", factory.getClasses()
1030:                        .containsKey("b.B"));
1031:                assertTrue("Removed class value b.B", factory.getClasses()
1032:                        .containsValue(b_B_b.getClassNode()));
1033:                assertTrue("Class b.B is no longer concrete", b_B_b
1034:                        .getClassNode().isConfirmed());
1035:                assertTrue("Removed feature key b.B.b", factory.getFeatures()
1036:                        .containsKey("b.B.b"));
1037:                assertTrue("Removed feature value b.B.b", factory.getFeatures()
1038:                        .containsValue(b_B_b));
1039:                assertTrue("Feature b.B.b is no longer concrete", b_B_b
1040:                        .isConfirmed());
1041:                assertFalse("Did not remove b.B <-- a.A", b_B_b
1042:                        .getInboundDependencies().contains(a_A_a));
1043:            }
1044:
1045:            /**
1046:             *  <p>Deleting class removes obsolete features.</p>
1047:             *  
1048:             *  <pre>
1049:             *  a
1050:             *  +-- A           <-- delete this
1051:             *      +-- a
1052:             *              <-- b.B.b
1053:             *  b
1054:             *  +-- B
1055:             *      +-- b
1056:             *              --> a.A.a
1057:             *  </pre>
1058:             *
1059:             *  <p>becomes:</p>
1060:             */
1061:            public void testAcceptClassWithFeatureWithDependencyOnReferencedFeature() {
1062:                FeatureNode a_A_a = factory.createFeature("a.A.a", true);
1063:                FeatureNode b_B_b = factory.createFeature("b.B.b", false);
1064:
1065:                a_A_a.addDependency(b_B_b);
1066:
1067:                assertTrue("Missing package key a", factory.getPackages()
1068:                        .containsKey("a"));
1069:                assertTrue("Missing package value a", factory.getPackages()
1070:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
1071:                assertTrue("Package a not concrete", a_A_a.getClassNode()
1072:                        .getPackageNode().isConfirmed());
1073:                assertTrue("Missing class key a.A", factory.getClasses()
1074:                        .containsKey("a.A"));
1075:                assertTrue("Missing class value a.A", factory.getClasses()
1076:                        .containsValue(a_A_a.getClassNode()));
1077:                assertTrue("Class a.A not concrete", a_A_a.getClassNode()
1078:                        .isConfirmed());
1079:                assertTrue("Missing feature key a.A.a", factory.getFeatures()
1080:                        .containsKey("a.A.a"));
1081:                assertTrue("Missing feature value a.A.a", factory.getFeatures()
1082:                        .containsValue(a_A_a));
1083:                assertTrue("Feature a.A.a not concrete", a_A_a.isConfirmed());
1084:                assertTrue("a.A.a --> b.B.b is missing", a_A_a
1085:                        .getOutboundDependencies().contains(b_B_b));
1086:
1087:                assertTrue("Missing package key b", factory.getPackages()
1088:                        .containsKey("b"));
1089:                assertTrue("Missing package value b", factory.getPackages()
1090:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
1091:                assertFalse("Package b is concrete", b_B_b.getClassNode()
1092:                        .getPackageNode().isConfirmed());
1093:                assertTrue("Missing class key b.B", factory.getClasses()
1094:                        .containsKey("b.B"));
1095:                assertTrue("Missing class value b.B", factory.getClasses()
1096:                        .containsValue(b_B_b.getClassNode()));
1097:                assertFalse("Class b.B is concrete", b_B_b.getClassNode()
1098:                        .isConfirmed());
1099:                assertTrue("Missing feature key b.B.b", factory.getFeatures()
1100:                        .containsKey("b.B.b"));
1101:                assertTrue("Missing feature value b.B.b", factory.getFeatures()
1102:                        .containsValue(b_B_b));
1103:                assertFalse("Feature b.B.b is concrete", b_B_b.isConfirmed());
1104:                assertTrue("b.B <-- a.A is missing", b_B_b
1105:                        .getInboundDependencies().contains(a_A_a));
1106:
1107:                a_A_a.getClassNode().accept(visitor);
1108:
1109:                assertFalse("Did not remove package key a", factory
1110:                        .getPackages().containsKey("a"));
1111:                assertFalse("Did not remove package value a", factory
1112:                        .getPackages().containsValue(
1113:                                a_A_a.getClassNode().getPackageNode()));
1114:                assertFalse("Package a is still concrete", a_A_a.getClassNode()
1115:                        .getPackageNode().isConfirmed());
1116:                assertFalse("Did not remove class key a.A", factory
1117:                        .getClasses().containsKey("a.A"));
1118:                assertFalse("Did not remove class value a.A", factory
1119:                        .getClasses().containsValue(a_A_a.getClassNode()));
1120:                assertFalse("Class a.A is still concrete", a_A_a.getClassNode()
1121:                        .isConfirmed());
1122:                assertFalse("Did not remove feature key a.A.a", factory
1123:                        .getFeatures().containsKey("a.A.a"));
1124:                assertFalse("Did not remove feature value a.A.a", factory
1125:                        .getFeatures().containsValue(a_A_a));
1126:                assertFalse("Feature a.A.a is still concrete", a_A_a
1127:                        .isConfirmed());
1128:                assertFalse("Did not remove a.A --> b.B", a_A_a
1129:                        .getOutboundDependencies().contains(b_B_b));
1130:
1131:                assertFalse("Did not remove package key b", factory
1132:                        .getPackages().containsKey("b"));
1133:                assertFalse("Did not remove package value b", factory
1134:                        .getPackages().containsValue(
1135:                                b_B_b.getClassNode().getPackageNode()));
1136:                assertFalse("Package b is now concrete", b_B_b.getClassNode()
1137:                        .getPackageNode().isConfirmed());
1138:                assertFalse("Did not remove class key b.B", factory
1139:                        .getClasses().containsKey("b.B"));
1140:                assertFalse("Did not remove class value b.B", factory
1141:                        .getClasses().containsValue(b_B_b.getClassNode()));
1142:                assertFalse("Class b.B is now concrete", b_B_b.getClassNode()
1143:                        .isConfirmed());
1144:                assertFalse("Did not remove feature key b.B.b", factory
1145:                        .getFeatures().containsKey("b.B.b"));
1146:                assertFalse("Did not remove feature value b.B.b", factory
1147:                        .getFeatures().containsValue(b_B_b));
1148:                assertFalse("Feature b.B.b is now concrete", b_B_b
1149:                        .isConfirmed());
1150:                assertFalse("Did not remove b.B <-- a.A", b_B_b
1151:                        .getInboundDependencies().contains(a_A_a));
1152:            }
1153:
1154:            /**
1155:             *  <p>Deleting feature removes obsolete features.</p>
1156:             *  
1157:             *  <pre>
1158:             *  a
1159:             *  +-- A
1160:             *      +-- a       <-- delete this
1161:             *              <-- b.B.b
1162:             *  b
1163:             *  +-- B
1164:             *      +-- b
1165:             *              --> a.A.a
1166:             *  </pre>
1167:             *
1168:             *  <p>becomes:</p>
1169:             *  
1170:             *  <pre>
1171:             *  a
1172:             *  +-- A
1173:             *  </pre>
1174:             */
1175:            public void testAcceptFeatureWithDependencyOnReferencedFeature() {
1176:                FeatureNode a_A_a = factory.createFeature("a.A.a", true);
1177:                FeatureNode b_B_b = factory.createFeature("b.B.b", false);
1178:
1179:                a_A_a.addDependency(b_B_b);
1180:
1181:                assertTrue("Missing package key a", factory.getPackages()
1182:                        .containsKey("a"));
1183:                assertTrue("Missing package value a", factory.getPackages()
1184:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
1185:                assertTrue("Package a not concrete", a_A_a.getClassNode()
1186:                        .getPackageNode().isConfirmed());
1187:                assertTrue("Missing class key a.A", factory.getClasses()
1188:                        .containsKey("a.A"));
1189:                assertTrue("Missing class value a.A", factory.getClasses()
1190:                        .containsValue(a_A_a.getClassNode()));
1191:                assertTrue("Class a.A not concrete", a_A_a.getClassNode()
1192:                        .isConfirmed());
1193:                assertTrue("Missing feature key a.A.a", factory.getFeatures()
1194:                        .containsKey("a.A.a"));
1195:                assertTrue("Missing feature value a.A.a", factory.getFeatures()
1196:                        .containsValue(a_A_a));
1197:                assertTrue("Feature a.A.a not concrete", a_A_a.isConfirmed());
1198:                assertTrue("a.A.a --> b.B.b is missing", a_A_a
1199:                        .getOutboundDependencies().contains(b_B_b));
1200:
1201:                assertTrue("Missing package key b", factory.getPackages()
1202:                        .containsKey("b"));
1203:                assertTrue("Missing package value b", factory.getPackages()
1204:                        .containsValue(b_B_b.getClassNode().getPackageNode()));
1205:                assertFalse("Package b is concrete", b_B_b.getClassNode()
1206:                        .getPackageNode().isConfirmed());
1207:                assertTrue("Missing class key b.B", factory.getClasses()
1208:                        .containsKey("b.B"));
1209:                assertTrue("Missing class value b.B", factory.getClasses()
1210:                        .containsValue(b_B_b.getClassNode()));
1211:                assertFalse("Class b.B is concrete", b_B_b.getClassNode()
1212:                        .isConfirmed());
1213:                assertTrue("Missing feature key b.B.b", factory.getFeatures()
1214:                        .containsKey("b.B.b"));
1215:                assertTrue("Missing feature value b.B.b", factory.getFeatures()
1216:                        .containsValue(b_B_b));
1217:                assertFalse("Feature b.B.b is concrete", b_B_b.isConfirmed());
1218:                assertTrue("b.B <-- a.A is missing", b_B_b
1219:                        .getInboundDependencies().contains(a_A_a));
1220:
1221:                a_A_a.accept(visitor);
1222:
1223:                assertTrue("Removed package key a", factory.getPackages()
1224:                        .containsKey("a"));
1225:                assertTrue("Removed package value a", factory.getPackages()
1226:                        .containsValue(a_A_a.getClassNode().getPackageNode()));
1227:                assertTrue("Package a is no longer concrete", a_A_a
1228:                        .getClassNode().getPackageNode().isConfirmed());
1229:                assertTrue("Removed class key a.A", factory.getClasses()
1230:                        .containsKey("a.A"));
1231:                assertTrue("Removed class value a.A", factory.getClasses()
1232:                        .containsValue(a_A_a.getClassNode()));
1233:                assertTrue("Class a.A is no longer concrete", a_A_a
1234:                        .getClassNode().isConfirmed());
1235:                assertFalse("Did not remove feature key a.A.a", factory
1236:                        .getFeatures().containsKey("a.A.a"));
1237:                assertFalse("Did not remove feature value a.A.a", factory
1238:                        .getFeatures().containsValue(a_A_a));
1239:                assertFalse("Feature a.A.a is still concrete", a_A_a
1240:                        .isConfirmed());
1241:                assertFalse("Did not remove a.A --> b.B", a_A_a
1242:                        .getOutboundDependencies().contains(b_B_b));
1243:
1244:                assertFalse("Did not remove package key b", factory
1245:                        .getPackages().containsKey("b"));
1246:                assertFalse("Did not remove package value b", factory
1247:                        .getPackages().containsValue(
1248:                                b_B_b.getClassNode().getPackageNode()));
1249:                assertFalse("Package b is now concrete", b_B_b.getClassNode()
1250:                        .getPackageNode().isConfirmed());
1251:                assertFalse("Did not remove class key b.B", factory
1252:                        .getClasses().containsKey("b.B"));
1253:                assertFalse("Did not remove class value b.B", factory
1254:                        .getClasses().containsValue(b_B_b.getClassNode()));
1255:                assertFalse("Class b.B is now concrete", b_B_b.getClassNode()
1256:                        .isConfirmed());
1257:                assertFalse("Did not remove feature key b.B.b", factory
1258:                        .getFeatures().containsKey("b.B.b"));
1259:                assertFalse("Did not remove feature value b.B.b", factory
1260:                        .getFeatures().containsValue(b_B_b));
1261:                assertFalse("Feature b.B.b is now concrete", b_B_b
1262:                        .isConfirmed());
1263:                assertFalse("Did not remove b.B <-- a.A", b_B_b
1264:                        .getInboundDependencies().contains(a_A_a));
1265:            }
1266:
1267:            public void testAcceptOutboundConcretePackage() {
1268:                PackageNode node = factory.createPackage("a", true);
1269:
1270:                assertTrue("Missing package key a", factory.getPackages()
1271:                        .containsKey("a"));
1272:                assertTrue("Missing package value a", factory.getPackages()
1273:                        .containsValue(node));
1274:                assertTrue("Package a not concrete", node.isConfirmed());
1275:
1276:                node.acceptOutbound(visitor);
1277:
1278:                assertTrue("Removed package key a", factory.getPackages()
1279:                        .containsKey("a"));
1280:                assertTrue("Removed package value a", factory.getPackages()
1281:                        .containsValue(node));
1282:                assertTrue("Package a is no longer concrete", node
1283:                        .isConfirmed());
1284:            }
1285:
1286:            public void testAcceptOutboundConcreteClass() {
1287:                ClassNode node = factory.createClass("a.A", true);
1288:
1289:                assertTrue("Missing package key a", factory.getPackages()
1290:                        .containsKey("a"));
1291:                assertTrue("Missing package value a", factory.getPackages()
1292:                        .containsValue(node.getPackageNode()));
1293:                assertTrue("Package a not concrete", node.getPackageNode()
1294:                        .isConfirmed());
1295:                assertTrue("Package node does not contain class node", node
1296:                        .getPackageNode().getClasses().contains(node));
1297:
1298:                assertTrue("Missing class key", factory.getClasses()
1299:                        .containsKey("a.A"));
1300:                assertTrue("Missing class value", factory.getClasses()
1301:                        .containsValue(node));
1302:                assertTrue("Class not concrete", node.isConfirmed());
1303:
1304:                node.acceptOutbound(visitor);
1305:
1306:                assertTrue("Removed package key a", factory.getPackages()
1307:                        .containsKey("a"));
1308:                assertTrue("Removed package value a", factory.getPackages()
1309:                        .containsValue(node.getPackageNode()));
1310:                assertTrue("Package a is no longer concrete", node
1311:                        .getPackageNode().isConfirmed());
1312:                assertTrue("Package node no longer contains class node", node
1313:                        .getPackageNode().getClasses().contains(node));
1314:
1315:                assertTrue("Removed class key", factory.getClasses()
1316:                        .containsKey("a.A"));
1317:                assertTrue("Removed class value", factory.getClasses()
1318:                        .containsValue(node));
1319:                assertTrue("Class a.A is no longer concrete", node
1320:                        .isConfirmed());
1321:            }
1322:
1323:            public void testAcceptOutboundConcreteFeature() {
1324:                FeatureNode node = factory.createFeature("a.A.a", true);
1325:
1326:                assertTrue("Missing package key a", factory.getPackages()
1327:                        .containsKey("a"));
1328:                assertTrue("Missing package value a", factory.getPackages()
1329:                        .containsValue(node.getClassNode().getPackageNode()));
1330:                assertTrue("Package a not concrete", node.getClassNode()
1331:                        .getPackageNode().isConfirmed());
1332:                assertTrue("Package node does not contain class node", node
1333:                        .getClassNode().getPackageNode().getClasses().contains(
1334:                                node.getClassNode()));
1335:
1336:                assertTrue("Missing class key", factory.getClasses()
1337:                        .containsKey("a.A"));
1338:                assertTrue("Missing class value", factory.getClasses()
1339:                        .containsValue(node.getClassNode()));
1340:                assertTrue("Class not concrete", node.getClassNode()
1341:                        .isConfirmed());
1342:                assertTrue("Class node does not contain feature node", node
1343:                        .getClassNode().getFeatures().contains(node));
1344:
1345:                assertTrue("Missing feature key", factory.getFeatures()
1346:                        .containsKey("a.A.a"));
1347:                assertTrue("Missing feature value", factory.getFeatures()
1348:                        .containsValue(node));
1349:                assertTrue("Feature not concrete", node.isConfirmed());
1350:
1351:                node.acceptOutbound(visitor);
1352:
1353:                assertTrue("Removed package key a", factory.getPackages()
1354:                        .containsKey("a"));
1355:                assertTrue("Removed package value a", factory.getPackages()
1356:                        .containsValue(node.getClassNode().getPackageNode()));
1357:                assertTrue("Package a is no longer concrete", node
1358:                        .getClassNode().getPackageNode().isConfirmed());
1359:                assertTrue("Package node no longer contains class node", node
1360:                        .getClassNode().getPackageNode().getClasses().contains(
1361:                                node.getClassNode()));
1362:
1363:                assertTrue("Removed class key", factory.getClasses()
1364:                        .containsKey("a.A"));
1365:                assertTrue("Removed class value", factory.getClasses()
1366:                        .containsValue(node.getClassNode()));
1367:                assertTrue("Class a.A is no longer concrete", node
1368:                        .getClassNode().isConfirmed());
1369:                assertTrue("Class node no longer contains feature node", node
1370:                        .getClassNode().getFeatures().contains(node));
1371:
1372:                assertTrue("Removed feature key", factory.getFeatures()
1373:                        .containsKey("a.A.a"));
1374:                assertTrue("Removed feature value", factory.getFeatures()
1375:                        .containsValue(node));
1376:                assertTrue("Feature a.A.a is no longer concrete", node
1377:                        .isConfirmed());
1378:            }
1379:
1380:            public void testAcceptOutboundEmptyNonConcretePackage() {
1381:                PackageNode node = factory.createPackage("a", false);
1382:
1383:                assertTrue("Missing package key a", factory.getPackages()
1384:                        .containsKey("a"));
1385:                assertTrue("Missing package value a", factory.getPackages()
1386:                        .containsValue(node));
1387:                assertFalse("Package a concrete", node.isConfirmed());
1388:
1389:                node.acceptOutbound(visitor);
1390:
1391:                assertFalse("Did not remove package key a", factory
1392:                        .getPackages().containsKey("a"));
1393:                assertFalse("Did not remove package value a", factory
1394:                        .getPackages().containsValue(node));
1395:                assertFalse("Package a is now concrete", node.isConfirmed());
1396:            }
1397:
1398:            public void testAcceptOutboundEmptyNonConcreteClass() {
1399:                ClassNode node = factory.createClass("a.A", false);
1400:
1401:                assertTrue("Missing package key a", factory.getPackages()
1402:                        .containsKey("a"));
1403:                assertTrue("Missing package value a", factory.getPackages()
1404:                        .containsValue(node.getPackageNode()));
1405:                assertFalse("Package a is concrete", node.getPackageNode()
1406:                        .isConfirmed());
1407:                assertTrue("Package node does not contain class node", node
1408:                        .getPackageNode().getClasses().contains(node));
1409:
1410:                assertTrue("Missing class key", factory.getClasses()
1411:                        .containsKey("a.A"));
1412:                assertTrue("Missing class value", factory.getClasses()
1413:                        .containsValue(node));
1414:                assertFalse("Class a.A is concrete", node.isConfirmed());
1415:
1416:                node.acceptOutbound(visitor);
1417:
1418:                assertFalse("Did not remove package key a", factory
1419:                        .getPackages().containsKey("a"));
1420:                assertFalse("Did not remove package value a", factory
1421:                        .getPackages().containsValue(node.getPackageNode()));
1422:                assertFalse("Package a is now concrete", node.getPackageNode()
1423:                        .isConfirmed());
1424:                assertFalse("Package node still contains class node", node
1425:                        .getPackageNode().getClasses().contains(node));
1426:
1427:                assertFalse("Did not remove class key", factory.getClasses()
1428:                        .containsKey("a.A"));
1429:                assertFalse("Did not remove class value", factory.getClasses()
1430:                        .containsValue(node));
1431:                assertFalse("Class a.A is now concrete", node.isConfirmed());
1432:            }
1433:
1434:            public void testAcceptOutboundEmptyNonConcreteFeature() {
1435:                FeatureNode node = factory.createFeature("a.A.a", false);
1436:
1437:                assertTrue("Missing package key a", factory.getPackages()
1438:                        .containsKey("a"));
1439:                assertTrue("Missing package value a", factory.getPackages()
1440:                        .containsValue(node.getClassNode().getPackageNode()));
1441:                assertFalse("Package a is concrete", node.getClassNode()
1442:                        .getPackageNode().isConfirmed());
1443:                assertTrue("Package node does not contain class node", node
1444:                        .getClassNode().getPackageNode().getClasses().contains(
1445:                                node.getClassNode()));
1446:
1447:                assertTrue("Missing class key", factory.getClasses()
1448:                        .containsKey("a.A"));
1449:                assertTrue("Missing class value", factory.getClasses()
1450:                        .containsValue(node.getClassNode()));
1451:                assertFalse("Class a.A is concrete", node.getClassNode()
1452:                        .isConfirmed());
1453:                assertTrue("Class node does not contain feature node", node
1454:                        .getClassNode().getFeatures().contains(node));
1455:
1456:                assertTrue("Missing feature key", factory.getFeatures()
1457:                        .containsKey("a.A.a"));
1458:                assertTrue("Missing feature value", factory.getFeatures()
1459:                        .containsValue(node));
1460:                assertFalse("Feature a.A.a is concrete", node.isConfirmed());
1461:
1462:                node.acceptOutbound(visitor);
1463:
1464:                assertFalse("Did not remove package key a", factory
1465:                        .getPackages().containsKey("a"));
1466:                assertFalse("Did not remove package value a", factory
1467:                        .getPackages().containsValue(
1468:                                node.getClassNode().getPackageNode()));
1469:                assertFalse("Package a is now concrete", node.getClassNode()
1470:                        .getPackageNode().isConfirmed());
1471:                assertFalse("Package node still contains class node", node
1472:                        .getClassNode().getPackageNode().getClasses().contains(
1473:                                node.getClassNode()));
1474:
1475:                assertFalse("Did not remove class key", factory.getClasses()
1476:                        .containsKey("a.A"));
1477:                assertFalse("Did not remove class value", factory.getClasses()
1478:                        .containsValue(node.getClassNode()));
1479:                assertFalse("Class a.A is now concrete", node.getClassNode()
1480:                        .isConfirmed());
1481:                assertFalse("Class node still contains feature node", node
1482:                        .getClassNode().getFeatures().contains(node));
1483:
1484:                assertFalse("Did not remove feature key", factory.getFeatures()
1485:                        .containsKey("a.A.a"));
1486:                assertFalse("Did not remove feature value", factory
1487:                        .getFeatures().containsValue(node));
1488:                assertFalse("Feature a.A.a is now concrete", node.isConfirmed());
1489:            }
1490:
1491:            public void testAcceptOutboundEmptyNonConcretePackageWithInboundDependency() {
1492:                PackageNode node1 = factory.createPackage("a", true);
1493:                PackageNode node2 = factory.createPackage("b", false);
1494:
1495:                node1.addDependency(node2);
1496:
1497:                assertTrue("Missing package key a", factory.getPackages()
1498:                        .containsKey("a"));
1499:                assertTrue("Missing package value a", factory.getPackages()
1500:                        .containsValue(node1));
1501:                assertTrue("Package a is not concrete", node1.isConfirmed());
1502:                assertTrue("a --> b is missing", node1
1503:                        .getOutboundDependencies().contains(node2));
1504:
1505:                assertTrue("Missing package key b", factory.getPackages()
1506:                        .containsKey("b"));
1507:                assertTrue("Missing package value b", factory.getPackages()
1508:                        .containsValue(node2));
1509:                assertFalse("Package b is concrete", node2.isConfirmed());
1510:                assertTrue("b <-- a is missing", node2.getInboundDependencies()
1511:                        .contains(node1));
1512:
1513:                node2.acceptOutbound(visitor);
1514:
1515:                assertTrue("Removed package key a", factory.getPackages()
1516:                        .containsKey("a"));
1517:                assertTrue("Removed package value a", factory.getPackages()
1518:                        .containsValue(node1));
1519:                assertTrue("Package a is no longer concrete", node1
1520:                        .isConfirmed());
1521:                assertTrue("Removed a --> b", node1.getOutboundDependencies()
1522:                        .contains(node2));
1523:
1524:                assertTrue("Removed package key b", factory.getPackages()
1525:                        .containsKey("b"));
1526:                assertTrue("Removed package value b", factory.getPackages()
1527:                        .containsValue(node2));
1528:                assertFalse("Package b is now concrete", node2.isConfirmed());
1529:                assertTrue("Removed b <-- a", node2.getInboundDependencies()
1530:                        .contains(node1));
1531:            }
1532:
1533:            public void testAcceptOutboundEmptyNonConcreteClassWithInboundDependency() {
1534:                ClassNode node1 = factory.createClass("a.A", true);
1535:                ClassNode node2 = factory.createClass("a.B", false);
1536:
1537:                node1.addDependency(node2);
1538:
1539:                assertTrue("Missing package key a", factory.getPackages()
1540:                        .containsKey("a"));
1541:                assertTrue("Missing package value a", factory.getPackages()
1542:                        .containsValue(node1.getPackageNode()));
1543:                assertTrue("Package a is not concrete", node1.getPackageNode()
1544:                        .isConfirmed());
1545:                assertTrue("Package node does not contain class node a.A",
1546:                        node1.getPackageNode().getClasses().contains(node1));
1547:                assertTrue("Package node does not contain class node a.B",
1548:                        node2.getPackageNode().getClasses().contains(node2));
1549:
1550:                assertTrue("Missing class key", factory.getClasses()
1551:                        .containsKey("a.A"));
1552:                assertTrue("Missing class value", factory.getClasses()
1553:                        .containsValue(node1));
1554:                assertTrue("Class a.A is not concrete", node1.isConfirmed());
1555:                assertTrue("a.A --> a.B is missing", node1
1556:                        .getOutboundDependencies().contains(node2));
1557:
1558:                assertTrue("Missing class key", factory.getClasses()
1559:                        .containsKey("a.B"));
1560:                assertTrue("Missing class value", factory.getClasses()
1561:                        .containsValue(node2));
1562:                assertFalse("Class a.B is concrete", node2.isConfirmed());
1563:                assertTrue("a.B <-- a.A is missing", node2
1564:                        .getInboundDependencies().contains(node1));
1565:
1566:                node2.acceptOutbound(visitor);
1567:
1568:                assertTrue("Removed package key a", factory.getPackages()
1569:                        .containsKey("a"));
1570:                assertTrue("Removed package value a", factory.getPackages()
1571:                        .containsValue(node1.getPackageNode()));
1572:                assertTrue("Package a is no longer concrete", node1
1573:                        .getPackageNode().isConfirmed());
1574:                assertTrue("Package node no longer contains class node a.A",
1575:                        node1.getPackageNode().getClasses().contains(node1));
1576:                assertTrue("Package node no longer contains class node a.B",
1577:                        node2.getPackageNode().getClasses().contains(node2));
1578:
1579:                assertTrue("Removed class key a.A", factory.getClasses()
1580:                        .containsKey("a.A"));
1581:                assertTrue("Removed class value a.A", factory.getClasses()
1582:                        .containsValue(node1));
1583:                assertTrue("Class a.A is no longer concrete", node1
1584:                        .isConfirmed());
1585:                assertTrue("Removed a.A --> a.B", node1
1586:                        .getOutboundDependencies().contains(node2));
1587:
1588:                assertTrue("Removed class key a.B", factory.getClasses()
1589:                        .containsKey("a.B"));
1590:                assertTrue("Removed class value a.B", factory.getClasses()
1591:                        .containsValue(node2));
1592:                assertFalse("Class a.B is now concrete", node2.isConfirmed());
1593:                assertTrue("Removed a.B <-- a.A", node2
1594:                        .getInboundDependencies().contains(node1));
1595:            }
1596:
1597:            public void testAcceptOutboundEmptyNonConcreteFeatureWithInboundDependency() {
1598:                FeatureNode node1 = factory.createFeature("a.A.a", true);
1599:                FeatureNode node2 = factory.createFeature("a.A.b", false);
1600:
1601:                node1.addDependency(node2);
1602:
1603:                assertTrue("Missing package key a", factory.getPackages()
1604:                        .containsKey("a"));
1605:                assertTrue("Missing package value a", factory.getPackages()
1606:                        .containsValue(node1.getClassNode().getPackageNode()));
1607:                assertTrue("Package a is not concrete", node1.getClassNode()
1608:                        .getPackageNode().isConfirmed());
1609:                assertTrue("Package node does not contain class node", node1
1610:                        .getClassNode().getPackageNode().getClasses().contains(
1611:                                node1.getClassNode()));
1612:
1613:                assertTrue("Missing class key", factory.getClasses()
1614:                        .containsKey("a.A"));
1615:                assertTrue("Missing class value", factory.getClasses()
1616:                        .containsValue(node1.getClassNode()));
1617:                assertTrue("Class a.A is not concrete", node1.getClassNode()
1618:                        .isConfirmed());
1619:                assertTrue("Class node does not contain feature node a.A.a",
1620:                        node1.getClassNode().getFeatures().contains(node1));
1621:                assertTrue("Class node does not contain feature node a.A.b",
1622:                        node2.getClassNode().getFeatures().contains(node2));
1623:
1624:                assertTrue("Missing feature key", factory.getFeatures()
1625:                        .containsKey("a.A.a"));
1626:                assertTrue("Missing feature value", factory.getFeatures()
1627:                        .containsValue(node1));
1628:                assertTrue("Feature a.A.a is not concrete", node1.isConfirmed());
1629:                assertTrue("a.A.a --> a.A.b is missing", node1
1630:                        .getOutboundDependencies().contains(node2));
1631:
1632:                assertTrue("Missing feature key", factory.getFeatures()
1633:                        .containsKey("a.A.b"));
1634:                assertTrue("Missing feature value", factory.getFeatures()
1635:                        .containsValue(node2));
1636:                assertFalse("Feature a.A.b is concrete", node2.isConfirmed());
1637:                assertTrue("a.A.b <-- a.A.a is missing", node2
1638:                        .getInboundDependencies().contains(node1));
1639:
1640:                node2.acceptOutbound(visitor);
1641:
1642:                assertTrue("Removed package key a", factory.getPackages()
1643:                        .containsKey("a"));
1644:                assertTrue("Removed package value a", factory.getPackages()
1645:                        .containsValue(node1.getClassNode().getPackageNode()));
1646:                assertTrue("Package a is no longer concrete", node1
1647:                        .getClassNode().getPackageNode().isConfirmed());
1648:                assertTrue("Package node no longer contains class node", node1
1649:                        .getClassNode().getPackageNode().getClasses().contains(
1650:                                node1.getClassNode()));
1651:
1652:                assertTrue("Did not remove class key", factory.getClasses()
1653:                        .containsKey("a.A"));
1654:                assertTrue("Did not remove class value", factory.getClasses()
1655:                        .containsValue(node1.getClassNode()));
1656:                assertTrue("Class a.A is no longer concrete", node1
1657:                        .getClassNode().isConfirmed());
1658:                assertTrue("Class node no longer contains feature node a.A.a",
1659:                        node1.getClassNode().getFeatures().contains(node1));
1660:                assertTrue("Class node no longer contains feature node a.A.b",
1661:                        node2.getClassNode().getFeatures().contains(node2));
1662:
1663:                assertTrue("Remove feature key", factory.getFeatures()
1664:                        .containsKey("a.A.a"));
1665:                assertTrue("Remove feature value", factory.getFeatures()
1666:                        .containsValue(node1));
1667:                assertTrue("Feature a.A.a is no longer concrete", node1
1668:                        .isConfirmed());
1669:                assertTrue("Removed a.A.a --> a.A.b", node1
1670:                        .getOutboundDependencies().contains(node2));
1671:
1672:                assertTrue("Remove feature key", factory.getFeatures()
1673:                        .containsKey("a.A.b"));
1674:                assertTrue("Remove feature value", factory.getFeatures()
1675:                        .containsValue(node2));
1676:                assertFalse("Feature a.A.b is now concrete", node2
1677:                        .isConfirmed());
1678:                assertTrue("Removed a.A.b <-- a.A.a", node2
1679:                        .getInboundDependencies().contains(node1));
1680:            }
1681:
1682:            public void testAcceptEmptyNonConcretePackageWithInboundDependency() {
1683:                PackageNode node1 = factory.createPackage("a", true);
1684:                PackageNode node2 = factory.createPackage("b", false);
1685:
1686:                node1.addDependency(node2);
1687:
1688:                assertTrue("Missing package key a", factory.getPackages()
1689:                        .containsKey("a"));
1690:                assertTrue("Missing package value a", factory.getPackages()
1691:                        .containsValue(node1));
1692:                assertTrue("Package a is not concrete", node1.isConfirmed());
1693:                assertTrue("a --> b is missing", node1
1694:                        .getOutboundDependencies().contains(node2));
1695:
1696:                assertTrue("Missing package key b", factory.getPackages()
1697:                        .containsKey("b"));
1698:                assertTrue("Missing package value b", factory.getPackages()
1699:                        .containsValue(node2));
1700:                assertFalse("Package b is concrete", node2.isConfirmed());
1701:                assertTrue("b <-- a is missing", node2.getInboundDependencies()
1702:                        .contains(node1));
1703:
1704:                node2.accept(visitor);
1705:
1706:                assertTrue("Removed package key a", factory.getPackages()
1707:                        .containsKey("a"));
1708:                assertTrue("Removed package value a", factory.getPackages()
1709:                        .containsValue(node1));
1710:                assertTrue("Package a is no longer concrete", node1
1711:                        .isConfirmed());
1712:                assertTrue("Removed a --> b", node1.getOutboundDependencies()
1713:                        .contains(node2));
1714:
1715:                assertTrue("Removed package key b", factory.getPackages()
1716:                        .containsKey("b"));
1717:                assertTrue("Removed package value b", factory.getPackages()
1718:                        .containsValue(node2));
1719:                assertFalse("Package b is now concrete", node2.isConfirmed());
1720:                assertTrue("Removed b <-- a", node2.getInboundDependencies()
1721:                        .contains(node1));
1722:            }
1723:
1724:            public void testAcceptEmptyNonConcreteClassWithInboundDependency() {
1725:                ClassNode node1 = factory.createClass("a.A", true);
1726:                ClassNode node2 = factory.createClass("a.B", false);
1727:
1728:                node1.addDependency(node2);
1729:
1730:                assertTrue("Missing package key a", factory.getPackages()
1731:                        .containsKey("a"));
1732:                assertTrue("Missing package value a", factory.getPackages()
1733:                        .containsValue(node1.getPackageNode()));
1734:                assertTrue("Package a is not concrete", node1.getPackageNode()
1735:                        .isConfirmed());
1736:                assertTrue("Package node does not contain class node a.A",
1737:                        node1.getPackageNode().getClasses().contains(node1));
1738:                assertTrue("Package node does not contain class node a.B",
1739:                        node2.getPackageNode().getClasses().contains(node2));
1740:
1741:                assertTrue("Missing class key", factory.getClasses()
1742:                        .containsKey("a.A"));
1743:                assertTrue("Missing class value", factory.getClasses()
1744:                        .containsValue(node1));
1745:                assertTrue("Class a.A is not concrete", node1.isConfirmed());
1746:                assertTrue("a.A --> a.B is missing", node1
1747:                        .getOutboundDependencies().contains(node2));
1748:
1749:                assertTrue("Missing class key", factory.getClasses()
1750:                        .containsKey("a.B"));
1751:                assertTrue("Missing class value", factory.getClasses()
1752:                        .containsValue(node2));
1753:                assertFalse("Class a.B is concrete", node2.isConfirmed());
1754:                assertTrue("a.B <-- a.A is missing", node2
1755:                        .getInboundDependencies().contains(node1));
1756:
1757:                node2.accept(visitor);
1758:
1759:                assertTrue("Removed package key a", factory.getPackages()
1760:                        .containsKey("a"));
1761:                assertTrue("Removed package value a", factory.getPackages()
1762:                        .containsValue(node1.getPackageNode()));
1763:                assertTrue("Package a is no longer concrete", node1
1764:                        .getPackageNode().isConfirmed());
1765:                assertTrue("Package node no longer contains class node a.A",
1766:                        node1.getPackageNode().getClasses().contains(node1));
1767:                assertTrue("Package node no longer contains class node a.B",
1768:                        node2.getPackageNode().getClasses().contains(node2));
1769:
1770:                assertTrue("Removed class key a.A", factory.getClasses()
1771:                        .containsKey("a.A"));
1772:                assertTrue("Removed class value a.A", factory.getClasses()
1773:                        .containsValue(node1));
1774:                assertTrue("Class a.A is no longer concrete", node1
1775:                        .isConfirmed());
1776:                assertTrue("Removed a.A --> a.B", node1
1777:                        .getOutboundDependencies().contains(node2));
1778:
1779:                assertTrue("Removed class key a.B", factory.getClasses()
1780:                        .containsKey("a.B"));
1781:                assertTrue("Removed class value a.B", factory.getClasses()
1782:                        .containsValue(node2));
1783:                assertFalse("Class a.B is now concrete", node2.isConfirmed());
1784:                assertTrue("Removed a.B <-- a.A", node2
1785:                        .getInboundDependencies().contains(node1));
1786:            }
1787:
1788:            public void testAcceptEmptyNonConcreteFeatureWithInboundDependency() {
1789:                FeatureNode node1 = factory.createFeature("a.A.a", true);
1790:                FeatureNode node2 = factory.createFeature("a.A.b", false);
1791:
1792:                node1.addDependency(node2);
1793:
1794:                assertTrue("Missing package key a", factory.getPackages()
1795:                        .containsKey("a"));
1796:                assertTrue("Missing package value a", factory.getPackages()
1797:                        .containsValue(node1.getClassNode().getPackageNode()));
1798:                assertTrue("Package a is not concrete", node1.getClassNode()
1799:                        .getPackageNode().isConfirmed());
1800:                assertTrue("Package node does not contain class node", node1
1801:                        .getClassNode().getPackageNode().getClasses().contains(
1802:                                node1.getClassNode()));
1803:
1804:                assertTrue("Missing class key", factory.getClasses()
1805:                        .containsKey("a.A"));
1806:                assertTrue("Missing class value", factory.getClasses()
1807:                        .containsValue(node1.getClassNode()));
1808:                assertTrue("Class a.A is not concrete", node1.getClassNode()
1809:                        .isConfirmed());
1810:                assertTrue("Class node does not contain feature node a.A.a",
1811:                        node1.getClassNode().getFeatures().contains(node1));
1812:                assertTrue("Class node does not contain feature node a.A.b",
1813:                        node2.getClassNode().getFeatures().contains(node2));
1814:
1815:                assertTrue("Missing feature key", factory.getFeatures()
1816:                        .containsKey("a.A.a"));
1817:                assertTrue("Missing feature value", factory.getFeatures()
1818:                        .containsValue(node1));
1819:                assertTrue("Feature a.A.a is not concrete", node1.isConfirmed());
1820:                assertTrue("a.A.a --> a.A.b is missing", node1
1821:                        .getOutboundDependencies().contains(node2));
1822:
1823:                assertTrue("Missing feature key", factory.getFeatures()
1824:                        .containsKey("a.A.b"));
1825:                assertTrue("Missing feature value", factory.getFeatures()
1826:                        .containsValue(node2));
1827:                assertFalse("Feature a.A.b is concrete", node2.isConfirmed());
1828:                assertTrue("a.A.b <-- a.A.a is missing", node2
1829:                        .getInboundDependencies().contains(node1));
1830:
1831:                node2.accept(visitor);
1832:
1833:                assertTrue("Removed package key a", factory.getPackages()
1834:                        .containsKey("a"));
1835:                assertTrue("Removed package value a", factory.getPackages()
1836:                        .containsValue(node1.getClassNode().getPackageNode()));
1837:                assertTrue("Package a is no longer concrete", node1
1838:                        .getClassNode().getPackageNode().isConfirmed());
1839:                assertTrue("Package node no longer contains class node", node1
1840:                        .getClassNode().getPackageNode().getClasses().contains(
1841:                                node1.getClassNode()));
1842:
1843:                assertTrue("Did not remove class key", factory.getClasses()
1844:                        .containsKey("a.A"));
1845:                assertTrue("Did not remove class value", factory.getClasses()
1846:                        .containsValue(node1.getClassNode()));
1847:                assertTrue("Class a.A is no longer concrete", node1
1848:                        .getClassNode().isConfirmed());
1849:                assertTrue("Class node no longer contains feature node a.A.a",
1850:                        node1.getClassNode().getFeatures().contains(node1));
1851:                assertTrue("Class node no longer contains feature node a.A.b",
1852:                        node2.getClassNode().getFeatures().contains(node2));
1853:
1854:                assertTrue("Remove feature key", factory.getFeatures()
1855:                        .containsKey("a.A.a"));
1856:                assertTrue("Remove feature value", factory.getFeatures()
1857:                        .containsValue(node1));
1858:                assertTrue("Feature a.A.a is no longer concrete", node1
1859:                        .isConfirmed());
1860:                assertTrue("Removed a.A.a --> a.A.b", node1
1861:                        .getOutboundDependencies().contains(node2));
1862:
1863:                assertTrue("Remove feature key", factory.getFeatures()
1864:                        .containsKey("a.A.b"));
1865:                assertTrue("Remove feature value", factory.getFeatures()
1866:                        .containsValue(node2));
1867:                assertFalse("Feature a.A.b is now concrete", node2
1868:                        .isConfirmed());
1869:                assertTrue("Removed a.A.b <-- a.A.a", node2
1870:                        .getInboundDependencies().contains(node1));
1871:            }
1872:
1873:            public void testAcceptEmptyConcretePackageWithInboundDependency() {
1874:                PackageNode node1 = factory.createPackage("a", true);
1875:                PackageNode node2 = factory.createPackage("b", true);
1876:
1877:                node1.addDependency(node2);
1878:
1879:                assertTrue("Missing package key a", factory.getPackages()
1880:                        .containsKey("a"));
1881:                assertTrue("Missing package value a", factory.getPackages()
1882:                        .containsValue(node1));
1883:                assertTrue("Package a is not concrete", node1.isConfirmed());
1884:                assertTrue("a --> b is missing", node1
1885:                        .getOutboundDependencies().contains(node2));
1886:
1887:                assertTrue("Missing package key b", factory.getPackages()
1888:                        .containsKey("b"));
1889:                assertTrue("Missing package value b", factory.getPackages()
1890:                        .containsValue(node2));
1891:                assertTrue("Package b is not concrete", node2.isConfirmed());
1892:                assertTrue("b <-- a is missing", node2.getInboundDependencies()
1893:                        .contains(node1));
1894:
1895:                node2.accept(visitor);
1896:
1897:                assertTrue("Removed package key a", factory.getPackages()
1898:                        .containsKey("a"));
1899:                assertTrue("Removed package value a", factory.getPackages()
1900:                        .containsValue(node1));
1901:                assertTrue("Package a is no longer concrete", node1
1902:                        .isConfirmed());
1903:                assertTrue("Removed a --> b", node1.getOutboundDependencies()
1904:                        .contains(node2));
1905:
1906:                assertTrue("Removed package key b", factory.getPackages()
1907:                        .containsKey("b"));
1908:                assertTrue("Removed package value b", factory.getPackages()
1909:                        .containsValue(node2));
1910:                assertFalse("Package b is still concrete", node2.isConfirmed());
1911:                assertTrue("Removed b <-- a", node2.getInboundDependencies()
1912:                        .contains(node1));
1913:            }
1914:
1915:            public void testAcceptEmptyConcreteClassWithInboundDependency() {
1916:                ClassNode node1 = factory.createClass("a.A", true);
1917:                ClassNode node2 = factory.createClass("a.B", true);
1918:
1919:                node1.addDependency(node2);
1920:
1921:                assertTrue("Missing package key a", factory.getPackages()
1922:                        .containsKey("a"));
1923:                assertTrue("Missing package value a", factory.getPackages()
1924:                        .containsValue(node1.getPackageNode()));
1925:                assertTrue("Package a is not concrete", node1.getPackageNode()
1926:                        .isConfirmed());
1927:                assertTrue("Package node does not contain class node a.A",
1928:                        node1.getPackageNode().getClasses().contains(node1));
1929:                assertTrue("Package node does not contain class node a.B",
1930:                        node2.getPackageNode().getClasses().contains(node2));
1931:
1932:                assertTrue("Missing class key", factory.getClasses()
1933:                        .containsKey("a.A"));
1934:                assertTrue("Missing class value", factory.getClasses()
1935:                        .containsValue(node1));
1936:                assertTrue("Class a.A is not concrete", node1.isConfirmed());
1937:                assertTrue("a.A --> a.B is missing", node1
1938:                        .getOutboundDependencies().contains(node2));
1939:
1940:                assertTrue("Missing class key", factory.getClasses()
1941:                        .containsKey("a.B"));
1942:                assertTrue("Missing class value", factory.getClasses()
1943:                        .containsValue(node2));
1944:                assertTrue("Class a.B is not concrete", node2.isConfirmed());
1945:                assertTrue("a.B <-- a.A is missing", node2
1946:                        .getInboundDependencies().contains(node1));
1947:
1948:                node2.accept(visitor);
1949:
1950:                assertTrue("Removed package key a", factory.getPackages()
1951:                        .containsKey("a"));
1952:                assertTrue("Removed package value a", factory.getPackages()
1953:                        .containsValue(node1.getPackageNode()));
1954:                assertTrue("Package a is no longer concrete", node1
1955:                        .getPackageNode().isConfirmed());
1956:                assertTrue("Package node no longer contains class node a.A",
1957:                        node1.getPackageNode().getClasses().contains(node1));
1958:                assertTrue("Package node no longer contains class node a.B",
1959:                        node2.getPackageNode().getClasses().contains(node2));
1960:
1961:                assertTrue("Removed class key a.A", factory.getClasses()
1962:                        .containsKey("a.A"));
1963:                assertTrue("Removed class value a.A", factory.getClasses()
1964:                        .containsValue(node1));
1965:                assertTrue("Class a.A is no longer concrete", node1
1966:                        .isConfirmed());
1967:                assertTrue("Removed a.A --> a.B", node1
1968:                        .getOutboundDependencies().contains(node2));
1969:
1970:                assertTrue("Removed class key a.B", factory.getClasses()
1971:                        .containsKey("a.B"));
1972:                assertTrue("Removed class value a.B", factory.getClasses()
1973:                        .containsValue(node2));
1974:                assertFalse("Class a.B is still concrete", node2.isConfirmed());
1975:                assertTrue("Removed a.B <-- a.A", node2
1976:                        .getInboundDependencies().contains(node1));
1977:            }
1978:
1979:            public void testAcceptEmptyConcreteFeatureWithInboundDependency() {
1980:                FeatureNode node1 = factory.createFeature("a.A.a", true);
1981:                FeatureNode node2 = factory.createFeature("a.A.b", true);
1982:
1983:                node1.addDependency(node2);
1984:
1985:                assertTrue("Missing package key a", factory.getPackages()
1986:                        .containsKey("a"));
1987:                assertTrue("Missing package value a", factory.getPackages()
1988:                        .containsValue(node1.getClassNode().getPackageNode()));
1989:                assertTrue("Package a is not concrete", node1.getClassNode()
1990:                        .getPackageNode().isConfirmed());
1991:                assertTrue("Package node does not contain class node", node1
1992:                        .getClassNode().getPackageNode().getClasses().contains(
1993:                                node1.getClassNode()));
1994:
1995:                assertTrue("Missing class key", factory.getClasses()
1996:                        .containsKey("a.A"));
1997:                assertTrue("Missing class value", factory.getClasses()
1998:                        .containsValue(node1.getClassNode()));
1999:                assertTrue("Class a.A is not concrete", node1.getClassNode()
2000:                        .isConfirmed());
2001:                assertTrue("Class node does not contain feature node a.A.a",
2002:                        node1.getClassNode().getFeatures().contains(node1));
2003:                assertTrue("Class node does not contain feature node a.A.b",
2004:                        node2.getClassNode().getFeatures().contains(node2));
2005:
2006:                assertTrue("Missing feature key", factory.getFeatures()
2007:                        .containsKey("a.A.a"));
2008:                assertTrue("Missing feature value", factory.getFeatures()
2009:                        .containsValue(node1));
2010:                assertTrue("Feature a.A.a is not concrete", node1.isConfirmed());
2011:                assertTrue("a.A.a --> a.A.b is missing", node1
2012:                        .getOutboundDependencies().contains(node2));
2013:
2014:                assertTrue("Missing feature key", factory.getFeatures()
2015:                        .containsKey("a.A.b"));
2016:                assertTrue("Missing feature value", factory.getFeatures()
2017:                        .containsValue(node2));
2018:                assertTrue("Feature a.A.b is not concrete", node2.isConfirmed());
2019:                assertTrue("a.A.b <-- a.A.a is missing", node2
2020:                        .getInboundDependencies().contains(node1));
2021:
2022:                node2.accept(visitor);
2023:
2024:                assertTrue("Removed package key a", factory.getPackages()
2025:                        .containsKey("a"));
2026:                assertTrue("Removed package value a", factory.getPackages()
2027:                        .containsValue(node1.getClassNode().getPackageNode()));
2028:                assertTrue("Package a is no longer concrete", node1
2029:                        .getClassNode().getPackageNode().isConfirmed());
2030:                assertTrue("Package node no longer contains class node", node1
2031:                        .getClassNode().getPackageNode().getClasses().contains(
2032:                                node1.getClassNode()));
2033:
2034:                assertTrue("Did not remove class key", factory.getClasses()
2035:                        .containsKey("a.A"));
2036:                assertTrue("Did not remove class value", factory.getClasses()
2037:                        .containsValue(node1.getClassNode()));
2038:                assertTrue("Class a.A is no longer concrete", node1
2039:                        .getClassNode().isConfirmed());
2040:                assertTrue("Class node no longer contains feature node a.A.a",
2041:                        node1.getClassNode().getFeatures().contains(node1));
2042:                assertTrue("Class node no longer contains feature node a.A.b",
2043:                        node2.getClassNode().getFeatures().contains(node2));
2044:
2045:                assertTrue("Remove feature key", factory.getFeatures()
2046:                        .containsKey("a.A.a"));
2047:                assertTrue("Remove feature value", factory.getFeatures()
2048:                        .containsValue(node1));
2049:                assertTrue("Feature a.A.a is no longer concrete", node1
2050:                        .isConfirmed());
2051:                assertTrue("Removed a.A.a --> a.A.b", node1
2052:                        .getOutboundDependencies().contains(node2));
2053:
2054:                assertTrue("Remove feature key", factory.getFeatures()
2055:                        .containsKey("a.A.b"));
2056:                assertTrue("Remove feature value", factory.getFeatures()
2057:                        .containsValue(node2));
2058:                assertFalse("Feature a.A.b is still concrete", node2
2059:                        .isConfirmed());
2060:                assertTrue("Removed a.A.b <-- a.A.a", node2
2061:                        .getInboundDependencies().contains(node1));
2062:            }
2063:
2064:            public void testAcceptOutboundNonEmptyPackage() {
2065:                PackageNode node1 = factory.createPackage("a", false);
2066:                ClassNode node2 = factory.createClass("a.A", false);
2067:
2068:                assertTrue("Missing package key a", factory.getPackages()
2069:                        .containsKey("a"));
2070:                assertTrue("Missing package value a", factory.getPackages()
2071:                        .containsValue(node1));
2072:                assertFalse("Package a concrete", node1.isConfirmed());
2073:                assertTrue("Package node does not contain class node", node1
2074:                        .getClasses().contains(node2));
2075:
2076:                assertTrue("Missing class key", factory.getClasses()
2077:                        .containsKey("a.A"));
2078:                assertTrue("Missing class value", factory.getClasses()
2079:                        .containsValue(node2));
2080:                assertFalse("Class a.A is concrete", node2.isConfirmed());
2081:
2082:                node1.acceptOutbound(visitor);
2083:
2084:                assertTrue("Removed package key a", factory.getPackages()
2085:                        .containsKey("a"));
2086:                assertTrue("Removed package value a", factory.getPackages()
2087:                        .containsValue(node1));
2088:                assertFalse("Package a is now concrete", node1.isConfirmed());
2089:                assertTrue("Package node no longer contains class node", node1
2090:                        .getClasses().contains(node2));
2091:
2092:                assertTrue("Removed class key", factory.getClasses()
2093:                        .containsKey("a.A"));
2094:                assertTrue("Removed class value", factory.getClasses()
2095:                        .containsValue(node2));
2096:                assertFalse("Class a.A is now concrete", node2.isConfirmed());
2097:            }
2098:
2099:            public void testAcceptOutboundNonEmptyClass() {
2100:                ClassNode node1 = factory.createClass("a.A", false);
2101:                FeatureNode node2 = factory.createFeature("a.A.a", false);
2102:
2103:                assertTrue("Missing package key a", factory.getPackages()
2104:                        .containsKey("a"));
2105:                assertTrue("Missing package value a", factory.getPackages()
2106:                        .containsValue(node1.getPackageNode()));
2107:                assertFalse("Package a is concrete", node1.getPackageNode()
2108:                        .isConfirmed());
2109:                assertTrue("Package node does not contain class node", node1
2110:                        .getPackageNode().getClasses().contains(node1));
2111:
2112:                assertTrue("Missing class key", factory.getClasses()
2113:                        .containsKey("a.A"));
2114:                assertTrue("Missing class value", factory.getClasses()
2115:                        .containsValue(node1));
2116:                assertFalse("Class a.A is concrete", node1.isConfirmed());
2117:                assertTrue("Class node does not contain feature node", node1
2118:                        .getFeatures().contains(node2));
2119:
2120:                assertTrue("Missing feature key", factory.getFeatures()
2121:                        .containsKey("a.A.a"));
2122:                assertTrue("Missing feature value", factory.getFeatures()
2123:                        .containsValue(node2));
2124:                assertFalse("Feature a.A.a is concrete", node2.isConfirmed());
2125:
2126:                node1.acceptOutbound(visitor);
2127:
2128:                assertTrue("Removed package key a", factory.getPackages()
2129:                        .containsKey("a"));
2130:                assertTrue("Removed package value a", factory.getPackages()
2131:                        .containsValue(node1.getPackageNode()));
2132:                assertFalse("Package a is now concrete", node1.getPackageNode()
2133:                        .isConfirmed());
2134:                assertTrue("Package node no longer contains class node", node1
2135:                        .getPackageNode().getClasses().contains(node1));
2136:
2137:                assertTrue("Removed class key", factory.getClasses()
2138:                        .containsKey("a.A"));
2139:                assertTrue("Removed class value", factory.getClasses()
2140:                        .containsValue(node1));
2141:                assertFalse("Class a.A is now concrete", node1.isConfirmed());
2142:                assertTrue("Class node no longer contains feature node", node1
2143:                        .getFeatures().contains(node2));
2144:
2145:                assertTrue("Removed feature key", factory.getFeatures()
2146:                        .containsKey("a.A.a"));
2147:                assertTrue("Removed feature value", factory.getFeatures()
2148:                        .containsValue(node2));
2149:                assertFalse("Feature a.A.a is now concrete", node2
2150:                        .isConfirmed());
2151:            }
2152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.