Source Code Cross Referenced for TestCycle.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) 


001:        /*
002:         *  Copyright (c) 2001-2007, Jean Tessier
003:         *  All rights reserved.
004:         *  
005:         *  Redistribution and use in source and binary forms, with or without
006:         *  modification, are permitted provided that the following conditions
007:         *  are met:
008:         *  
009:         *      * Redistributions of source code must retain the above copyright
010:         *        notice, this list of conditions and the following disclaimer.
011:         *  
012:         *      * Redistributions in binary form must reproduce the above copyright
013:         *        notice, this list of conditions and the following disclaimer in the
014:         *        documentation and/or other materials provided with the distribution.
015:         *  
016:         *      * Neither the name of Jean Tessier nor the names of his contributors
017:         *        may be used to endorse or promote products derived from this software
018:         *        without specific prior written permission.
019:         *  
020:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
023:         *  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
024:         *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025:         *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026:         *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027:         *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028:         *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:         *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030:         *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:         */
032:
033:        package com.jeantessier.dependency;
034:
035:        import java.util.*;
036:
037:        import junit.framework.*;
038:
039:        public class TestCycle extends TestCase {
040:            private Node a;
041:            private Node b;
042:            private Node c;
043:            private Node d;
044:            private Node e;
045:
046:            protected void setUp() throws Exception {
047:                NodeFactory factory = new NodeFactory();
048:
049:                a = factory.createPackage("a");
050:                b = factory.createPackage("b");
051:                c = factory.createPackage("c");
052:                d = factory.createPackage("d");
053:                e = factory.createPackage("e");
054:            }
055:
056:            public void testConstructEmptyCycle() {
057:                try {
058:                    new Cycle(new ArrayList<Node>());
059:                    fail("Constructed empty cycle");
060:                } catch (Exception ex) {
061:                    // expected
062:                }
063:            }
064:
065:            public void testConstructLength1Cycle() {
066:                List<Node> path = new ArrayList<Node>();
067:                path.add(a);
068:                Cycle cycle = new Cycle(path);
069:
070:                assertEquals("length", 1, cycle.getLength());
071:                assertEquals("a", a, cycle.getPath().iterator().next());
072:            }
073:
074:            public void testEquals_Identical() {
075:                List<Node> path1 = new ArrayList<Node>();
076:                path1.add(a);
077:                path1.add(b);
078:                Cycle cycle1 = new Cycle(path1);
079:
080:                List<Node> path2 = new ArrayList<Node>();
081:                path2.add(a);
082:                path2.add(b);
083:                Cycle cycle2 = new Cycle(path2);
084:
085:                assertTrue(cycle1.equals(cycle2));
086:                assertTrue(cycle2.equals(cycle1));
087:            }
088:
089:            public void testEquals_Reversed() {
090:                List<Node> path1 = new ArrayList<Node>();
091:                path1.add(a);
092:                path1.add(b);
093:                Cycle cycle1 = new Cycle(path1);
094:
095:                List<Node> path2 = new ArrayList<Node>();
096:                path2.add(b);
097:                path2.add(a);
098:                Cycle cycle2 = new Cycle(path2);
099:
100:                assertTrue(cycle1.equals(cycle2));
101:                assertTrue(cycle2.equals(cycle1));
102:            }
103:
104:            public void testEquals_SameLength() {
105:                List<Node> path1 = new ArrayList<Node>();
106:                path1.add(a);
107:                path1.add(b);
108:                Cycle cycle1 = new Cycle(path1);
109:
110:                List<Node> path2 = new ArrayList<Node>();
111:                path2.add(c);
112:                path2.add(d);
113:                Cycle cycle2 = new Cycle(path2);
114:
115:                assertFalse(cycle1.equals(cycle2));
116:                assertFalse(cycle2.equals(cycle1));
117:            }
118:
119:            public void testEquals_DifferentLength() {
120:                List<Node> path1 = new ArrayList<Node>();
121:                path1.add(a);
122:                path1.add(b);
123:                Cycle cycle1 = new Cycle(path1);
124:
125:                List<Node> path2 = new ArrayList<Node>();
126:                path2.add(c);
127:                path2.add(d);
128:                path2.add(e);
129:                Cycle cycle2 = new Cycle(path2);
130:
131:                assertFalse(cycle1.equals(cycle2));
132:                assertFalse(cycle2.equals(cycle1));
133:            }
134:
135:            public void testEquals_LengthTrumpsContent() {
136:                List<Node> path1 = new ArrayList<Node>();
137:                path1.add(a);
138:                path1.add(b);
139:                path1.add(c);
140:                Cycle cycle1 = new Cycle(path1);
141:
142:                List<Node> path2 = new ArrayList<Node>();
143:                path2.add(d);
144:                path2.add(e);
145:                Cycle cycle2 = new Cycle(path2);
146:
147:                assertFalse(cycle1.equals(cycle2));
148:                assertFalse(cycle2.equals(cycle1));
149:            }
150:
151:            public void testCompareTo_Identical() {
152:                List<Node> path1 = new ArrayList<Node>();
153:                path1.add(a);
154:                path1.add(b);
155:                Cycle cycle1 = new Cycle(path1);
156:
157:                List<Node> path2 = new ArrayList<Node>();
158:                path2.add(a);
159:                path2.add(b);
160:                Cycle cycle2 = new Cycle(path2);
161:
162:                assertEquals(0, cycle1.compareTo(cycle2));
163:                assertEquals(0, cycle2.compareTo(cycle1));
164:            }
165:
166:            public void testCompareTo_Reversed() {
167:                List<Node> path1 = new ArrayList<Node>();
168:                path1.add(a);
169:                path1.add(b);
170:                Cycle cycle1 = new Cycle(path1);
171:
172:                List<Node> path2 = new ArrayList<Node>();
173:                path2.add(b);
174:                path2.add(a);
175:                Cycle cycle2 = new Cycle(path2);
176:
177:                assertEquals(0, cycle1.compareTo(cycle2));
178:                assertEquals(0, cycle2.compareTo(cycle1));
179:            }
180:
181:            public void testCompareTo_SameLength() {
182:                List<Node> path1 = new ArrayList<Node>();
183:                path1.add(a);
184:                path1.add(b);
185:                Cycle cycle1 = new Cycle(path1);
186:
187:                List<Node> path2 = new ArrayList<Node>();
188:                path2.add(c);
189:                path2.add(d);
190:                Cycle cycle2 = new Cycle(path2);
191:
192:                assertTrue(cycle1.compareTo(cycle2) < 0);
193:                assertTrue(cycle2.compareTo(cycle1) > 0);
194:            }
195:
196:            public void testCompareTo_DifferentLength() {
197:                List<Node> path1 = new ArrayList<Node>();
198:                path1.add(a);
199:                path1.add(b);
200:                Cycle cycle1 = new Cycle(path1);
201:
202:                List<Node> path2 = new ArrayList<Node>();
203:                path2.add(c);
204:                path2.add(d);
205:                path2.add(e);
206:                Cycle cycle2 = new Cycle(path2);
207:
208:                assertTrue(cycle1.compareTo(cycle2) < 0);
209:                assertTrue(cycle2.compareTo(cycle1) > 0);
210:            }
211:
212:            public void testCompareTo_LengthTrumpsContent() {
213:                List<Node> path1 = new ArrayList<Node>();
214:                path1.add(a);
215:                path1.add(b);
216:                path1.add(c);
217:                Cycle cycle1 = new Cycle(path1);
218:
219:                List<Node> path2 = new ArrayList<Node>();
220:                path2.add(d);
221:                path2.add(e);
222:                Cycle cycle2 = new Cycle(path2);
223:
224:                assertTrue(cycle1.compareTo(cycle2) > 0);
225:                assertTrue(cycle2.compareTo(cycle1) < 0);
226:            }
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.