diff options
author | Timo Westkämper <[email protected]> | 2014-04-17 23:26:13 +0300 |
---|---|---|
committer | Timo Westkämper <[email protected]> | 2014-04-17 23:26:13 +0300 |
commit | f64dfb33396d4a5fc7f5cd93e865167d37ef1351 (patch) | |
tree | 77087b4f3913479d227fa6333374aeb4add60c1f /api/src/test | |
parent | 418e3db25eb9f526ce8b766047d1a04c5f5ba6db (diff) |
Fix tests
Diffstat (limited to 'api/src/test')
-rw-r--r-- | api/src/test/java/org/semver/jardiff/ClassInheritanceTest.java | 14 | ||||
-rw-r--r-- | api/src/test/java/org/semver/jardiff/DeprecateDetectionTest.java | 7 |
2 files changed, 13 insertions, 8 deletions
diff --git a/api/src/test/java/org/semver/jardiff/ClassInheritanceTest.java b/api/src/test/java/org/semver/jardiff/ClassInheritanceTest.java index 2624ba0..24a3d4c 100644 --- a/api/src/test/java/org/semver/jardiff/ClassInheritanceTest.java +++ b/api/src/test/java/org/semver/jardiff/ClassInheritanceTest.java @@ -81,8 +81,12 @@ public class ClassInheritanceTest { addClassInfo(newClassInfoMap, InheritanceRoot.class, jd, loadInfoMethod); // Make B look like A - newClassInfoMap.put(ClassA.class.getName(), newClassInfoMap.get(ClassB.class.getName())); - newClassInfoMap.remove(ClassB.class.getName()); + ClassInfo a = oldClassInfoMap.get("org/semver/jardiff/ClassInheritanceTest$ClassA"); + ClassInfo b = newClassInfoMap.get("org/semver/jardiff/ClassInheritanceTest$ClassB"); + newClassInfoMap.put(a.getName(), new ClassInfo(b.getVersion(), b.getAccess(), a.getName(), + b.getSignature(), b.getSupername(), b.getInterfaces(), + b.getMethodMap(), b.getFieldMap())); + newClassInfoMap.remove(b.getName()); DifferenceAccumulatingHandler handler = new DifferenceAccumulatingHandler(); diffMethod.invoke(jd, handler, new SimpleDiffCriteria(), "0.1.0", "0.2.0", oldClassInfoMap, newClassInfoMap); @@ -94,13 +98,13 @@ public class ClassInheritanceTest { System.err.println(" : " + ((Change) d).getModifiedInfo().getName()); } } - Assert.assertEquals("differences found", 0, handler.getDelta().getDifferences().size()); + Assert.assertEquals("differences found", 1, handler.getDelta().getDifferences().size()); } private void addClassInfo(Map<String, ClassInfo> classMap, Class klass, JarDiff jd, Method loadInfoMethod) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, IOException { - ClassInfo classInfo = (ClassInfo) loadInfoMethod.invoke(jd, new ClassReader(ClassA.class.getName())); - classMap.put(klass.getName(), classInfo); + ClassInfo classInfo = (ClassInfo) loadInfoMethod.invoke(jd, new ClassReader(klass.getName())); + classMap.put(classInfo.getName(), classInfo); } } diff --git a/api/src/test/java/org/semver/jardiff/DeprecateDetectionTest.java b/api/src/test/java/org/semver/jardiff/DeprecateDetectionTest.java index 6cc85d6..26558cb 100644 --- a/api/src/test/java/org/semver/jardiff/DeprecateDetectionTest.java +++ b/api/src/test/java/org/semver/jardiff/DeprecateDetectionTest.java @@ -91,8 +91,9 @@ public class DeprecateDetectionTest { addClassInfo(newClassInfoMap, InheritanceRoot.class, jd, loadInfoMethod); // Make B look like A - newClassInfoMap.put(ClassA.class.getName(), newClassInfoMap.get(ClassB.class.getName())); - newClassInfoMap.remove(ClassB.class.getName()); + newClassInfoMap.put("org/semver/jardiff/DeprecateDetectionTest$ClassA", + newClassInfoMap.get("org/semver/jardiff/DeprecateDetectionTest$ClassB")); + newClassInfoMap.remove("org/semver/jardiff/DeprecateDetectionTest$ClassB"); DifferenceAccumulatingHandler handler = new DifferenceAccumulatingHandler(); diffMethod.invoke(jd, handler, new SimpleDiffCriteria(), "0.1.0", "0.2.0", oldClassInfoMap, newClassInfoMap); @@ -113,6 +114,6 @@ public class DeprecateDetectionTest { private void addClassInfo(Map<String, ClassInfo> classMap, Class klass, JarDiff jd, Method loadInfoMethod) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, IOException { ClassInfo classInfo = (ClassInfo) loadInfoMethod.invoke(jd, new ClassReader(klass.getName())); - classMap.put(klass.getName(), classInfo); + classMap.put(classInfo.getName(), classInfo); } } |