Source Code Cross Referenced for TestIncompatibleDifferenceStrategy.java in  » Code-Analyzer » DependencyFinder » com » jeantessier » diff » 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.diff 
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.diff;
034:
035:        import java.io.*;
036:        import java.util.*;
037:
038:        import com.jeantessier.classreader.*;
039:
040:        public class TestIncompatibleDifferenceStrategy extends
041:                TestDifferencesFactoryBase {
042:            private MockDifferenceStrategy mockStrategy;
043:            private IncompatibleDifferenceStrategy strategy;
044:
045:            protected void setUp() throws Exception {
046:                super .setUp();
047:
048:                mockStrategy = new MockDifferenceStrategy(
049:                        new NoDifferenceStrategy());
050:                strategy = new IncompatibleDifferenceStrategy(mockStrategy);
051:            }
052:
053:            public void testUnmodifiedConstantValue() {
054:                ConstantValue_attribute oldValue = getOldJar().getClassfile(
055:                        "UnmodifiedPackage.UnmodifiedInterface").getField(
056:                        "unmodifiedField").getConstantValue();
057:                ConstantValue_attribute newValue = getNewJar().getClassfile(
058:                        "UnmodifiedPackage.UnmodifiedInterface").getField(
059:                        "unmodifiedField").getConstantValue();
060:
061:                assertFalse(strategy.isConstantValueDifferent(oldValue,
062:                        newValue));
063:
064:                assertEquals("package", 0, mockStrategy
065:                        .getPackageDifferentCount());
066:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
067:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
068:                assertEquals("constant", 1, mockStrategy
069:                        .getConstantValueDifferentCount());
070:                assertEquals("method", 0, mockStrategy
071:                        .getMethodDifferentCount());
072:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
073:            }
074:
075:            public void testRemovedConstantValue() {
076:                ConstantValue_attribute oldValue = getOldJar().getClassfile(
077:                        "ModifiedPackage.ModifiedInterface").getField(
078:                        "removedField").getConstantValue();
079:                ConstantValue_attribute newValue = null;
080:
081:                assertFalse(strategy.isConstantValueDifferent(oldValue,
082:                        newValue));
083:
084:                assertEquals("package", 0, mockStrategy
085:                        .getPackageDifferentCount());
086:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
087:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
088:                assertEquals("constant", 1, mockStrategy
089:                        .getConstantValueDifferentCount());
090:                assertEquals("method", 0, mockStrategy
091:                        .getMethodDifferentCount());
092:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
093:            }
094:
095:            public void testModifiedConstantValue() {
096:                ConstantValue_attribute oldValue = getOldJar().getClassfile(
097:                        "ModifiedPackage.ModifiedInterface").getField(
098:                        "modifiedValueField").getConstantValue();
099:                ConstantValue_attribute newValue = getNewJar().getClassfile(
100:                        "ModifiedPackage.ModifiedInterface").getField(
101:                        "modifiedValueField").getConstantValue();
102:
103:                assertFalse(strategy.isConstantValueDifferent(oldValue,
104:                        newValue));
105:
106:                assertEquals("package", 0, mockStrategy
107:                        .getPackageDifferentCount());
108:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
109:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
110:                assertEquals("constant", 1, mockStrategy
111:                        .getConstantValueDifferentCount());
112:                assertEquals("method", 0, mockStrategy
113:                        .getMethodDifferentCount());
114:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
115:            }
116:
117:            public void testNewConstantValue() {
118:                ConstantValue_attribute oldValue = null;
119:                ConstantValue_attribute newValue = getNewJar().getClassfile(
120:                        "ModifiedPackage.ModifiedInterface").getField(
121:                        "newField").getConstantValue();
122:
123:                assertFalse(strategy.isConstantValueDifferent(oldValue,
124:                        newValue));
125:
126:                assertEquals("package", 0, mockStrategy
127:                        .getPackageDifferentCount());
128:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
129:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
130:                assertEquals("constant", 1, mockStrategy
131:                        .getConstantValueDifferentCount());
132:                assertEquals("method", 0, mockStrategy
133:                        .getMethodDifferentCount());
134:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
135:            }
136:
137:            public void testUnmodifiedField() {
138:                Field_info oldFeature = getOldJar().getClassfile(
139:                        "UnmodifiedPackage.UnmodifiedClass").getField(
140:                        "unmodifiedField");
141:                Field_info newFeature = getNewJar().getClassfile(
142:                        "UnmodifiedPackage.UnmodifiedClass").getField(
143:                        "unmodifiedField");
144:
145:                assertFalse(strategy.isFieldDifferent(oldFeature, newFeature));
146:
147:                assertEquals("package", 0, mockStrategy
148:                        .getPackageDifferentCount());
149:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
150:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
151:                assertEquals("constant", 0, mockStrategy
152:                        .getConstantValueDifferentCount());
153:                assertEquals("method", 0, mockStrategy
154:                        .getMethodDifferentCount());
155:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
156:            }
157:
158:            public void testRemovedField() {
159:                Field_info oldFeature = getOldJar().getClassfile(
160:                        "ModifiedPackage.ModifiedClass").getField(
161:                        "removedField");
162:                Field_info newFeature = getNewJar().getClassfile(
163:                        "ModifiedPackage.ModifiedClass").getField(
164:                        "removedField");
165:
166:                assertTrue(strategy.isFieldDifferent(oldFeature, newFeature));
167:
168:                assertEquals("package", 0, mockStrategy
169:                        .getPackageDifferentCount());
170:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
171:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
172:                assertEquals("constant", 0, mockStrategy
173:                        .getConstantValueDifferentCount());
174:                assertEquals("method", 0, mockStrategy
175:                        .getMethodDifferentCount());
176:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
177:            }
178:
179:            public void testModifiedField() {
180:                Field_info oldFeature = getOldJar().getClassfile(
181:                        "ModifiedPackage.ModifiedClass").getField(
182:                        "modifiedField");
183:                Field_info newFeature = getNewJar().getClassfile(
184:                        "ModifiedPackage.ModifiedClass").getField(
185:                        "modifiedField");
186:
187:                assertTrue(strategy.isFieldDifferent(oldFeature, newFeature));
188:
189:                assertEquals("package", 0, mockStrategy
190:                        .getPackageDifferentCount());
191:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
192:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
193:                assertEquals("constant", 0, mockStrategy
194:                        .getConstantValueDifferentCount());
195:                assertEquals("method", 0, mockStrategy
196:                        .getMethodDifferentCount());
197:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
198:            }
199:
200:            public void testModifiedValueField() {
201:                Field_info oldFeature = getOldJar().getClassfile(
202:                        "ModifiedPackage.ModifiedInterface").getField(
203:                        "modifiedValueField");
204:                Field_info newFeature = getNewJar().getClassfile(
205:                        "ModifiedPackage.ModifiedInterface").getField(
206:                        "modifiedValueField");
207:
208:                assertFalse(strategy.isFieldDifferent(oldFeature, newFeature));
209:
210:                assertEquals("package", 0, mockStrategy
211:                        .getPackageDifferentCount());
212:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
213:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
214:                assertEquals("constant", 0, mockStrategy
215:                        .getConstantValueDifferentCount());
216:                assertEquals("method", 0, mockStrategy
217:                        .getMethodDifferentCount());
218:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
219:            }
220:
221:            public void testDeprecatedField() {
222:                Field_info oldFeature = getOldJar().getClassfile(
223:                        "ModifiedPackage.ModifiedInterface").getField(
224:                        "deprecatedField");
225:                Field_info newFeature = getNewJar().getClassfile(
226:                        "ModifiedPackage.ModifiedInterface").getField(
227:                        "deprecatedField");
228:
229:                assertTrue(strategy.isFieldDifferent(oldFeature, newFeature));
230:
231:                assertEquals("package", 0, mockStrategy
232:                        .getPackageDifferentCount());
233:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
234:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
235:                assertEquals("constant", 0, mockStrategy
236:                        .getConstantValueDifferentCount());
237:                assertEquals("method", 0, mockStrategy
238:                        .getMethodDifferentCount());
239:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
240:            }
241:
242:            public void testUndeprecatedField() {
243:                Field_info oldFeature = getOldJar().getClassfile(
244:                        "ModifiedPackage.ModifiedInterface").getField(
245:                        "undeprecatedField");
246:                Field_info newFeature = getNewJar().getClassfile(
247:                        "ModifiedPackage.ModifiedInterface").getField(
248:                        "undeprecatedField");
249:
250:                assertFalse(strategy.isFieldDifferent(oldFeature, newFeature));
251:
252:                assertEquals("package", 0, mockStrategy
253:                        .getPackageDifferentCount());
254:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
255:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
256:                assertEquals("constant", 0, mockStrategy
257:                        .getConstantValueDifferentCount());
258:                assertEquals("method", 0, mockStrategy
259:                        .getMethodDifferentCount());
260:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
261:            }
262:
263:            public void testNewField() {
264:                Field_info oldFeature = getOldJar().getClassfile(
265:                        "ModifiedPackage.ModifiedClass").getField("newField");
266:                Field_info newFeature = getNewJar().getClassfile(
267:                        "ModifiedPackage.ModifiedClass").getField("newField");
268:
269:                assertFalse(strategy.isFieldDifferent(oldFeature, newFeature));
270:
271:                assertEquals("package", 0, mockStrategy
272:                        .getPackageDifferentCount());
273:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
274:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
275:                assertEquals("constant", 0, mockStrategy
276:                        .getConstantValueDifferentCount());
277:                assertEquals("method", 0, mockStrategy
278:                        .getMethodDifferentCount());
279:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
280:            }
281:
282:            public void testUnmodifiedCode() {
283:                Code_attribute oldCode = getOldJar().getClassfile(
284:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
285:                        "unmodifiedMethod()").getCode();
286:                Code_attribute newCode = getNewJar().getClassfile(
287:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
288:                        "unmodifiedMethod()").getCode();
289:
290:                assertFalse(strategy.isCodeDifferent(oldCode, newCode));
291:
292:                assertEquals("package", 0, mockStrategy
293:                        .getPackageDifferentCount());
294:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
295:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
296:                assertEquals("constant", 0, mockStrategy
297:                        .getConstantValueDifferentCount());
298:                assertEquals("method", 0, mockStrategy
299:                        .getMethodDifferentCount());
300:                assertEquals("code", 1, mockStrategy.getCodeDifferentCount());
301:            }
302:
303:            public void testModifiedCode() {
304:                Code_attribute oldCode = getOldJar().getClassfile(
305:                        "ModifiedPackage.ModifiedClass").getMethod(
306:                        "modifiedCodeMethod()").getCode();
307:                Code_attribute newCode = getNewJar().getClassfile(
308:                        "ModifiedPackage.ModifiedClass").getMethod(
309:                        "modifiedCodeMethod()").getCode();
310:
311:                assertFalse(strategy.isCodeDifferent(oldCode, newCode));
312:
313:                assertEquals("package", 0, mockStrategy
314:                        .getPackageDifferentCount());
315:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
316:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
317:                assertEquals("constant", 0, mockStrategy
318:                        .getConstantValueDifferentCount());
319:                assertEquals("method", 0, mockStrategy
320:                        .getMethodDifferentCount());
321:                assertEquals("code", 1, mockStrategy.getCodeDifferentCount());
322:            }
323:
324:            public void testUnmodifiedConstructor() {
325:                Method_info oldMethod = getOldJar().getClassfile(
326:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
327:                        "UnmodifiedClass()");
328:                Method_info newMethod = getNewJar().getClassfile(
329:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
330:                        "UnmodifiedClass()");
331:
332:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
333:
334:                assertEquals("package", 0, mockStrategy
335:                        .getPackageDifferentCount());
336:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
337:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
338:                assertEquals("constant", 0, mockStrategy
339:                        .getConstantValueDifferentCount());
340:                assertEquals("method", 0, mockStrategy
341:                        .getMethodDifferentCount());
342:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
343:            }
344:
345:            public void testRemovedConstructor() {
346:                Method_info oldMethod = getOldJar().getClassfile(
347:                        "ModifiedPackage.ModifiedClass").getMethod(
348:                        "ModifiedClass()");
349:                Method_info newMethod = getNewJar().getClassfile(
350:                        "ModifiedPackage.ModifiedClass").getMethod(
351:                        "ModifiedClass()");
352:
353:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
354:
355:                assertEquals("package", 0, mockStrategy
356:                        .getPackageDifferentCount());
357:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
358:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
359:                assertEquals("constant", 0, mockStrategy
360:                        .getConstantValueDifferentCount());
361:                assertEquals("method", 0, mockStrategy
362:                        .getMethodDifferentCount());
363:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
364:            }
365:
366:            public void testModifiedConstructor() {
367:                Method_info oldMethod = getOldJar().getClassfile(
368:                        "ModifiedPackage.ModifiedClass").getMethod(
369:                        "ModifiedClass(int, int, int)");
370:                Method_info newMethod = getNewJar().getClassfile(
371:                        "ModifiedPackage.ModifiedClass").getMethod(
372:                        "ModifiedClass(int, int, int)");
373:
374:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
375:
376:                assertEquals("package", 0, mockStrategy
377:                        .getPackageDifferentCount());
378:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
379:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
380:                assertEquals("constant", 0, mockStrategy
381:                        .getConstantValueDifferentCount());
382:                assertEquals("method", 0, mockStrategy
383:                        .getMethodDifferentCount());
384:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
385:            }
386:
387:            public void testModifiedCodeConstructor() {
388:                Method_info oldMethod = getOldJar().getClassfile(
389:                        "ModifiedPackage.ModifiedClass").getMethod(
390:                        "ModifiedClass(float)");
391:                Method_info newMethod = getNewJar().getClassfile(
392:                        "ModifiedPackage.ModifiedClass").getMethod(
393:                        "ModifiedClass(float)");
394:
395:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
396:
397:                assertEquals("package", 0, mockStrategy
398:                        .getPackageDifferentCount());
399:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
400:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
401:                assertEquals("constant", 0, mockStrategy
402:                        .getConstantValueDifferentCount());
403:                assertEquals("method", 0, mockStrategy
404:                        .getMethodDifferentCount());
405:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
406:            }
407:
408:            public void testDeprecatedConstructor() {
409:                Method_info oldMethod = getOldJar().getClassfile(
410:                        "ModifiedPackage.ModifiedClass").getMethod(
411:                        "ModifiedClass(int)");
412:                Method_info newMethod = getNewJar().getClassfile(
413:                        "ModifiedPackage.ModifiedClass").getMethod(
414:                        "ModifiedClass(int)");
415:
416:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
417:
418:                assertEquals("package", 0, mockStrategy
419:                        .getPackageDifferentCount());
420:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
421:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
422:                assertEquals("constant", 0, mockStrategy
423:                        .getConstantValueDifferentCount());
424:                assertEquals("method", 0, mockStrategy
425:                        .getMethodDifferentCount());
426:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
427:            }
428:
429:            public void testUndeprecatedConstructor() {
430:                Method_info oldMethod = getOldJar().getClassfile(
431:                        "ModifiedPackage.ModifiedClass").getMethod(
432:                        "ModifiedClass(int, int, int, int, int)");
433:                Method_info newMethod = getNewJar().getClassfile(
434:                        "ModifiedPackage.ModifiedClass").getMethod(
435:                        "ModifiedClass(int, int, int, int, int)");
436:
437:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
438:
439:                assertEquals("package", 0, mockStrategy
440:                        .getPackageDifferentCount());
441:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
442:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
443:                assertEquals("constant", 0, mockStrategy
444:                        .getConstantValueDifferentCount());
445:                assertEquals("method", 0, mockStrategy
446:                        .getMethodDifferentCount());
447:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
448:            }
449:
450:            public void testNewConstructor() {
451:                Method_info oldMethod = getOldJar().getClassfile(
452:                        "ModifiedPackage.ModifiedClass").getMethod(
453:                        "ModifiedClass(int, int, int, int, int, int)");
454:                Method_info newMethod = getNewJar().getClassfile(
455:                        "ModifiedPackage.ModifiedClass").getMethod(
456:                        "ModifiedClass(int, int, int, int, int, int)");
457:
458:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
459:
460:                assertEquals("package", 0, mockStrategy
461:                        .getPackageDifferentCount());
462:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
463:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
464:                assertEquals("constant", 0, mockStrategy
465:                        .getConstantValueDifferentCount());
466:                assertEquals("method", 0, mockStrategy
467:                        .getMethodDifferentCount());
468:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
469:            }
470:
471:            public void testUnmodifiedMethod() {
472:                Method_info oldMethod = getOldJar().getClassfile(
473:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
474:                        "unmodifiedMethod()");
475:                Method_info newMethod = getNewJar().getClassfile(
476:                        "UnmodifiedPackage.UnmodifiedClass").getMethod(
477:                        "unmodifiedMethod()");
478:
479:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
480:
481:                assertEquals("package", 0, mockStrategy
482:                        .getPackageDifferentCount());
483:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
484:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
485:                assertEquals("constant", 0, mockStrategy
486:                        .getConstantValueDifferentCount());
487:                assertEquals("method", 0, mockStrategy
488:                        .getMethodDifferentCount());
489:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
490:            }
491:
492:            public void testRemovedMethod() {
493:                Method_info oldMethod = getOldJar().getClassfile(
494:                        "ModifiedPackage.ModifiedClass").getMethod(
495:                        "removedMethod()");
496:                Method_info newMethod = getNewJar().getClassfile(
497:                        "ModifiedPackage.ModifiedClass").getMethod(
498:                        "removedMethod()");
499:
500:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
501:
502:                assertEquals("package", 0, mockStrategy
503:                        .getPackageDifferentCount());
504:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
505:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
506:                assertEquals("constant", 0, mockStrategy
507:                        .getConstantValueDifferentCount());
508:                assertEquals("method", 0, mockStrategy
509:                        .getMethodDifferentCount());
510:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
511:            }
512:
513:            public void testModifiedMethod() {
514:                Method_info oldMethod = getOldJar().getClassfile(
515:                        "ModifiedPackage.ModifiedClass").getMethod(
516:                        "modifiedMethod()");
517:                Method_info newMethod = getNewJar().getClassfile(
518:                        "ModifiedPackage.ModifiedClass").getMethod(
519:                        "modifiedMethod()");
520:
521:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
522:
523:                assertEquals("package", 0, mockStrategy
524:                        .getPackageDifferentCount());
525:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
526:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
527:                assertEquals("constant", 0, mockStrategy
528:                        .getConstantValueDifferentCount());
529:                assertEquals("method", 0, mockStrategy
530:                        .getMethodDifferentCount());
531:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
532:            }
533:
534:            public void testModifiedCodeMethod() {
535:                Method_info oldMethod = getOldJar().getClassfile(
536:                        "ModifiedPackage.ModifiedClass").getMethod(
537:                        "modifiedCodeMethod()");
538:                Method_info newMethod = getNewJar().getClassfile(
539:                        "ModifiedPackage.ModifiedClass").getMethod(
540:                        "modifiedCodeMethod()");
541:
542:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
543:
544:                assertEquals("package", 0, mockStrategy
545:                        .getPackageDifferentCount());
546:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
547:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
548:                assertEquals("constant", 0, mockStrategy
549:                        .getConstantValueDifferentCount());
550:                assertEquals("method", 0, mockStrategy
551:                        .getMethodDifferentCount());
552:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
553:            }
554:
555:            public void testDeprecatedMethod() {
556:                Method_info oldMethod = getOldJar().getClassfile(
557:                        "ModifiedPackage.ModifiedClass").getMethod(
558:                        "deprecatedMethod()");
559:                Method_info newMethod = getNewJar().getClassfile(
560:                        "ModifiedPackage.ModifiedClass").getMethod(
561:                        "deprecatedMethod()");
562:
563:                assertTrue(strategy.isMethodDifferent(oldMethod, newMethod));
564:
565:                assertEquals("package", 0, mockStrategy
566:                        .getPackageDifferentCount());
567:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
568:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
569:                assertEquals("constant", 0, mockStrategy
570:                        .getConstantValueDifferentCount());
571:                assertEquals("method", 0, mockStrategy
572:                        .getMethodDifferentCount());
573:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
574:            }
575:
576:            public void testUndeprecatedMethod() {
577:                Method_info oldMethod = getOldJar().getClassfile(
578:                        "ModifiedPackage.ModifiedClass").getMethod(
579:                        "undeprecatedMethod()");
580:                Method_info newMethod = getNewJar().getClassfile(
581:                        "ModifiedPackage.ModifiedClass").getMethod(
582:                        "undeprecatedMethod()");
583:
584:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
585:
586:                assertEquals("package", 0, mockStrategy
587:                        .getPackageDifferentCount());
588:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
589:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
590:                assertEquals("constant", 0, mockStrategy
591:                        .getConstantValueDifferentCount());
592:                assertEquals("method", 0, mockStrategy
593:                        .getMethodDifferentCount());
594:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
595:            }
596:
597:            public void testNewMethod() {
598:                Method_info oldMethod = getOldJar().getClassfile(
599:                        "ModifiedPackage.ModifiedClass").getMethod(
600:                        "newMethod()");
601:                Method_info newMethod = getNewJar().getClassfile(
602:                        "ModifiedPackage.ModifiedClass").getMethod(
603:                        "newMethod()");
604:
605:                assertFalse(strategy.isMethodDifferent(oldMethod, newMethod));
606:
607:                assertEquals("package", 0, mockStrategy
608:                        .getPackageDifferentCount());
609:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
610:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
611:                assertEquals("constant", 0, mockStrategy
612:                        .getConstantValueDifferentCount());
613:                assertEquals("method", 0, mockStrategy
614:                        .getMethodDifferentCount());
615:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
616:            }
617:
618:            public void testUnmodifiedInterface() {
619:                Classfile oldClass = getOldJar().getClassfile(
620:                        "UnmodifiedPackage.UnmodifiedInterface");
621:                Classfile newClass = getNewJar().getClassfile(
622:                        "UnmodifiedPackage.UnmodifiedInterface");
623:
624:                assertFalse(strategy.isClassDifferent(oldClass, newClass));
625:
626:                assertEquals("package", 0, mockStrategy
627:                        .getPackageDifferentCount());
628:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
629:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
630:                assertEquals("constant", 0, mockStrategy
631:                        .getConstantValueDifferentCount());
632:                assertEquals("method", 0, mockStrategy
633:                        .getMethodDifferentCount());
634:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
635:            }
636:
637:            public void testRemovedInterface() {
638:                Classfile oldClass = getOldJar().getClassfile(
639:                        "ModifiedPackage.RemovedInterface");
640:                Classfile newClass = getNewJar().getClassfile(
641:                        "ModifiedPackage.RemovedInterface");
642:
643:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
644:
645:                assertEquals("package", 0, mockStrategy
646:                        .getPackageDifferentCount());
647:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
648:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
649:                assertEquals("constant", 0, mockStrategy
650:                        .getConstantValueDifferentCount());
651:                assertEquals("method", 0, mockStrategy
652:                        .getMethodDifferentCount());
653:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
654:            }
655:
656:            public void testModifiedDeclarationInterface() {
657:                Classfile oldClass = getOldJar().getClassfile(
658:                        "ModifiedPackage.ModifiedDeclarationInterface");
659:                Classfile newClass = getNewJar().getClassfile(
660:                        "ModifiedPackage.ModifiedDeclarationInterface");
661:
662:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
663:
664:                assertEquals("package", 0, mockStrategy
665:                        .getPackageDifferentCount());
666:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
667:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
668:                assertEquals("constant", 0, mockStrategy
669:                        .getConstantValueDifferentCount());
670:                assertEquals("method", 0, mockStrategy
671:                        .getMethodDifferentCount());
672:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
673:            }
674:
675:            public void testModifiedInterface() {
676:                Classfile oldClass = getOldJar().getClassfile(
677:                        "ModifiedPackage.ModifiedInterface");
678:                Classfile newClass = getNewJar().getClassfile(
679:                        "ModifiedPackage.ModifiedInterface");
680:
681:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
682:
683:                assertEquals("package", 0, mockStrategy
684:                        .getPackageDifferentCount());
685:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
686:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
687:                assertEquals("constant", 0, mockStrategy
688:                        .getConstantValueDifferentCount());
689:                assertEquals("method", 0, mockStrategy
690:                        .getMethodDifferentCount());
691:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
692:            }
693:
694:            public void testNewInterface() {
695:                Classfile oldClass = getOldJar().getClassfile(
696:                        "ModifiedPackage.NewInterface");
697:                Classfile newClass = getNewJar().getClassfile(
698:                        "ModifiedPackage.NewInterface");
699:
700:                assertFalse(strategy.isClassDifferent(oldClass, newClass));
701:
702:                assertEquals("package", 0, mockStrategy
703:                        .getPackageDifferentCount());
704:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
705:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
706:                assertEquals("constant", 0, mockStrategy
707:                        .getConstantValueDifferentCount());
708:                assertEquals("method", 0, mockStrategy
709:                        .getMethodDifferentCount());
710:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
711:            }
712:
713:            public void testUnmodifiedClass() {
714:                Classfile oldClass = getOldJar().getClassfile(
715:                        "UnmodifiedPackage.UnmodifiedClass");
716:                Classfile newClass = getNewJar().getClassfile(
717:                        "UnmodifiedPackage.UnmodifiedClass");
718:
719:                assertFalse(strategy.isClassDifferent(oldClass, newClass));
720:
721:                assertEquals("package", 0, mockStrategy
722:                        .getPackageDifferentCount());
723:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
724:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
725:                assertEquals("constant", 0, mockStrategy
726:                        .getConstantValueDifferentCount());
727:                assertEquals("method", 0, mockStrategy
728:                        .getMethodDifferentCount());
729:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
730:            }
731:
732:            public void testRemovedClass() {
733:                Classfile oldClass = getOldJar().getClassfile(
734:                        "ModifiedPackage.RemovedClass");
735:                Classfile newClass = getNewJar().getClassfile(
736:                        "ModifiedPackage.RemovedClass");
737:
738:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
739:
740:                assertEquals("package", 0, mockStrategy
741:                        .getPackageDifferentCount());
742:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
743:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
744:                assertEquals("constant", 0, mockStrategy
745:                        .getConstantValueDifferentCount());
746:                assertEquals("method", 0, mockStrategy
747:                        .getMethodDifferentCount());
748:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
749:            }
750:
751:            public void testModifiedDeclarationClass() {
752:                Classfile oldClass = getOldJar().getClassfile(
753:                        "ModifiedPackage.ModifiedDeclarationClass");
754:                Classfile newClass = getNewJar().getClassfile(
755:                        "ModifiedPackage.ModifiedDeclarationClass");
756:
757:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
758:
759:                assertEquals("package", 0, mockStrategy
760:                        .getPackageDifferentCount());
761:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
762:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
763:                assertEquals("constant", 0, mockStrategy
764:                        .getConstantValueDifferentCount());
765:                assertEquals("method", 0, mockStrategy
766:                        .getMethodDifferentCount());
767:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
768:            }
769:
770:            public void testModifiedClass() {
771:                Classfile oldClass = getOldJar().getClassfile(
772:                        "ModifiedPackage.ModifiedClass");
773:                Classfile newClass = getNewJar().getClassfile(
774:                        "ModifiedPackage.ModifiedClass");
775:
776:                assertTrue(strategy.isClassDifferent(oldClass, newClass));
777:
778:                assertEquals("package", 0, mockStrategy
779:                        .getPackageDifferentCount());
780:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
781:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
782:                assertEquals("constant", 0, mockStrategy
783:                        .getConstantValueDifferentCount());
784:                assertEquals("method", 0, mockStrategy
785:                        .getMethodDifferentCount());
786:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
787:            }
788:
789:            public void testNewClass() {
790:                Classfile oldClass = getOldJar().getClassfile(
791:                        "ModifiedPackage.NewClass");
792:                Classfile newClass = getNewJar().getClassfile(
793:                        "ModifiedPackage.NewClass");
794:
795:                assertFalse(strategy.isClassDifferent(oldClass, newClass));
796:
797:                assertEquals("package", 0, mockStrategy
798:                        .getPackageDifferentCount());
799:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
800:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
801:                assertEquals("constant", 0, mockStrategy
802:                        .getConstantValueDifferentCount());
803:                assertEquals("method", 0, mockStrategy
804:                        .getMethodDifferentCount());
805:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
806:            }
807:
808:            public void testUnmodifiedPackage() {
809:                Map oldPackage = new HashMap();
810:                oldPackage.put("UnmodifiedPackage.UnmodifiedClass", getOldJar()
811:                        .getClassfile("UnmodifiedPackage.UnmodifiedClass"));
812:                oldPackage.put("UnmodifiedPackage.UnmodifiedInterface",
813:                        getOldJar().getClassfile(
814:                                "UnmodifiedPackage.UnmodifiedInterface"));
815:                Map newPackage = new HashMap();
816:                newPackage.put("UnmodifiedPackage.UnmodifiedClass", getNewJar()
817:                        .getClassfile("UnmodifiedPackage.UnmodifiedClass"));
818:                newPackage.put("UnmodifiedPackage.UnmodifiedInterface",
819:                        getNewJar().getClassfile(
820:                                "UnmodifiedPackage.UnmodifiedInterface"));
821:
822:                assertFalse(strategy.isPackageDifferent(oldPackage, newPackage));
823:
824:                assertEquals("package", 0, mockStrategy
825:                        .getPackageDifferentCount());
826:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
827:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
828:                assertEquals("constant", 0, mockStrategy
829:                        .getConstantValueDifferentCount());
830:                assertEquals("method", 0, mockStrategy
831:                        .getMethodDifferentCount());
832:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
833:            }
834:
835:            public void testRemovedPackage() {
836:                Map oldPackage = new HashMap();
837:                oldPackage.put("RemovedPackage.RemovedClass", getOldJar()
838:                        .getClassfile("RemovedPackage.RemovedClass"));
839:                Map newPackage = new HashMap();
840:
841:                assertTrue(strategy.isPackageDifferent(oldPackage, newPackage));
842:
843:                assertEquals("package", 0, mockStrategy
844:                        .getPackageDifferentCount());
845:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
846:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
847:                assertEquals("constant", 0, mockStrategy
848:                        .getConstantValueDifferentCount());
849:                assertEquals("method", 0, mockStrategy
850:                        .getMethodDifferentCount());
851:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
852:            }
853:
854:            public void testModifiedPackage() {
855:                Map oldPackage = new HashMap();
856:                oldPackage.put("UnmodifiedPackage.UnmodifiedClass", getOldJar()
857:                        .getClassfile("UnmodifiedPackage.UnmodifiedClass"));
858:                oldPackage.put("UnmodifiedPackage.UnmodifiedInterface",
859:                        getOldJar().getClassfile(
860:                                "UnmodifiedPackage.UnmodifiedInterface"));
861:                Map newPackage = new HashMap();
862:                newPackage.put("UnmodifiedPackage.UnmodifiedClass", getNewJar()
863:                        .getClassfile("UnmodifiedPackage.UnmodifiedClass"));
864:
865:                assertTrue(strategy.isPackageDifferent(oldPackage, newPackage));
866:
867:                assertEquals("package", 0, mockStrategy
868:                        .getPackageDifferentCount());
869:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
870:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
871:                assertEquals("constant", 0, mockStrategy
872:                        .getConstantValueDifferentCount());
873:                assertEquals("method", 0, mockStrategy
874:                        .getMethodDifferentCount());
875:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
876:            }
877:
878:            public void testModifiedCodePackage() {
879:                Map oldPackage = new HashMap();
880:                oldPackage.put("ModifiedPackage.ModifiedClass", getOldJar()
881:                        .getClassfile("ModifiedPackage.ModifiedClass"));
882:                Map newPackage = new HashMap();
883:                newPackage.put("ModifiedPackage.ModifiedClass", getNewJar()
884:                        .getClassfile("ModifiedPackage.ModifiedClass"));
885:
886:                assertTrue(strategy.isPackageDifferent(oldPackage, newPackage));
887:
888:                assertEquals("package", 0, mockStrategy
889:                        .getPackageDifferentCount());
890:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
891:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
892:                assertEquals("constant", 0, mockStrategy
893:                        .getConstantValueDifferentCount());
894:                assertEquals("method", 0, mockStrategy
895:                        .getMethodDifferentCount());
896:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
897:            }
898:
899:            public void testNewPackage() {
900:                Map oldPackage = new HashMap();
901:                Map newPackage = new HashMap();
902:                newPackage.put("NewPackage.NewClass", getNewJar().getClassfile(
903:                        "NewPackage.NewClass"));
904:
905:                assertFalse(strategy.isPackageDifferent(oldPackage, newPackage));
906:
907:                assertEquals("package", 0, mockStrategy
908:                        .getPackageDifferentCount());
909:                assertEquals("class", 0, mockStrategy.getClassDifferentCount());
910:                assertEquals("field", 0, mockStrategy.getFieldDifferentCount());
911:                assertEquals("constant", 0, mockStrategy
912:                        .getConstantValueDifferentCount());
913:                assertEquals("method", 0, mockStrategy
914:                        .getMethodDifferentCount());
915:                assertEquals("code", 0, mockStrategy.getCodeDifferentCount());
916:            }
917:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.