diff options
| author | 2015-05-24 11:23:36 -0400 | |
|---|---|---|
| committer | 2015-05-24 11:23:36 -0400 | |
| commit | c7a3de184dc51526ee157d47981a74ffba284f5d (patch) | |
| tree | cd6741dccaea95e760632db3f60fec378949602e /test | |
| parent | relicense Enigma as LGPL (diff) | |
| download | enigma-c7a3de184dc51526ee157d47981a74ffba284f5d.tar.gz enigma-c7a3de184dc51526ee157d47981a74ffba284f5d.tar.xz enigma-c7a3de184dc51526ee157d47981a74ffba284f5d.zip | |
fix broken tests, and one broken function. =)
Diffstat (limited to 'test')
| -rw-r--r-- | test/cuchaz/enigma/TestJarIndexInheritanceTree.java | 27 | ||||
| -rw-r--r-- | test/cuchaz/enigma/TestJarIndexLoneClass.java | 10 |
2 files changed, 24 insertions, 13 deletions
diff --git a/test/cuchaz/enigma/TestJarIndexInheritanceTree.java b/test/cuchaz/enigma/TestJarIndexInheritanceTree.java index 04d4fb23..d3c23eaf 100644 --- a/test/cuchaz/enigma/TestJarIndexInheritanceTree.java +++ b/test/cuchaz/enigma/TestJarIndexInheritanceTree.java | |||
| @@ -10,9 +10,19 @@ | |||
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | package cuchaz.enigma; | 11 | package cuchaz.enigma; |
| 12 | 12 | ||
| 13 | import static cuchaz.enigma.TestEntryFactory.*; | 13 | import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByConstructor; |
| 14 | import static org.hamcrest.MatcherAssert.*; | 14 | import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByMethod; |
| 15 | import static org.hamcrest.Matchers.*; | 15 | import static cuchaz.enigma.TestEntryFactory.newClass; |
| 16 | import static cuchaz.enigma.TestEntryFactory.newConstructor; | ||
| 17 | import static cuchaz.enigma.TestEntryFactory.newField; | ||
| 18 | import static cuchaz.enigma.TestEntryFactory.newFieldReferenceByConstructor; | ||
| 19 | import static cuchaz.enigma.TestEntryFactory.newFieldReferenceByMethod; | ||
| 20 | import static cuchaz.enigma.TestEntryFactory.newMethod; | ||
| 21 | import static org.hamcrest.MatcherAssert.assertThat; | ||
| 22 | import static org.hamcrest.Matchers.contains; | ||
| 23 | import static org.hamcrest.Matchers.containsInAnyOrder; | ||
| 24 | import static org.hamcrest.Matchers.empty; | ||
| 25 | import static org.hamcrest.Matchers.is; | ||
| 16 | 26 | ||
| 17 | import java.util.Collection; | 27 | import java.util.Collection; |
| 18 | import java.util.Set; | 28 | import java.util.Set; |
| @@ -33,6 +43,7 @@ public class TestJarIndexInheritanceTree { | |||
| 33 | 43 | ||
| 34 | private JarIndex m_index; | 44 | private JarIndex m_index; |
| 35 | 45 | ||
| 46 | private ClassEntry m_objectClass = newClass("java/lang/Object"); | ||
| 36 | private ClassEntry m_baseClass = newClass("none/a"); | 47 | private ClassEntry m_baseClass = newClass("none/a"); |
| 37 | private ClassEntry m_subClassA = newClass("none/b"); | 48 | private ClassEntry m_subClassA = newClass("none/b"); |
| 38 | private ClassEntry m_subClassAA = newClass("none/d"); | 49 | private ClassEntry m_subClassAA = newClass("none/d"); |
| @@ -63,8 +74,8 @@ public class TestJarIndexInheritanceTree { | |||
| 63 | TranslationIndex index = m_index.getTranslationIndex(); | 74 | TranslationIndex index = m_index.getTranslationIndex(); |
| 64 | 75 | ||
| 65 | // base class | 76 | // base class |
| 66 | assertThat(index.getSuperclass(m_baseClass), is(nullValue())); | 77 | assertThat(index.getSuperclass(m_baseClass), is(m_objectClass)); |
| 67 | assertThat(index.getAncestry(m_baseClass), is(empty())); | 78 | assertThat(index.getAncestry(m_baseClass), contains(m_objectClass)); |
| 68 | assertThat(index.getSubclass(m_baseClass), containsInAnyOrder( | 79 | assertThat(index.getSubclass(m_baseClass), containsInAnyOrder( |
| 69 | m_subClassA, | 80 | m_subClassA, |
| 70 | m_subClassB | 81 | m_subClassB |
| @@ -72,17 +83,17 @@ public class TestJarIndexInheritanceTree { | |||
| 72 | 83 | ||
| 73 | // subclass a | 84 | // subclass a |
| 74 | assertThat(index.getSuperclass(m_subClassA), is(m_baseClass)); | 85 | assertThat(index.getSuperclass(m_subClassA), is(m_baseClass)); |
| 75 | assertThat(index.getAncestry(m_subClassA), contains(m_baseClass)); | 86 | assertThat(index.getAncestry(m_subClassA), contains(m_baseClass, m_objectClass)); |
| 76 | assertThat(index.getSubclass(m_subClassA), contains(m_subClassAA)); | 87 | assertThat(index.getSubclass(m_subClassA), contains(m_subClassAA)); |
| 77 | 88 | ||
| 78 | // subclass aa | 89 | // subclass aa |
| 79 | assertThat(index.getSuperclass(m_subClassAA), is(m_subClassA)); | 90 | assertThat(index.getSuperclass(m_subClassAA), is(m_subClassA)); |
| 80 | assertThat(index.getAncestry(m_subClassAA), contains(m_subClassA, m_baseClass)); | 91 | assertThat(index.getAncestry(m_subClassAA), contains(m_subClassA, m_baseClass, m_objectClass)); |
| 81 | assertThat(index.getSubclass(m_subClassAA), is(empty())); | 92 | assertThat(index.getSubclass(m_subClassAA), is(empty())); |
| 82 | 93 | ||
| 83 | // subclass b | 94 | // subclass b |
| 84 | assertThat(index.getSuperclass(m_subClassB), is(m_baseClass)); | 95 | assertThat(index.getSuperclass(m_subClassB), is(m_baseClass)); |
| 85 | assertThat(index.getAncestry(m_subClassB), contains(m_baseClass)); | 96 | assertThat(index.getAncestry(m_subClassB), contains(m_baseClass, m_objectClass)); |
| 86 | assertThat(index.getSubclass(m_subClassB), is(empty())); | 97 | assertThat(index.getSubclass(m_subClassB), is(empty())); |
| 87 | } | 98 | } |
| 88 | 99 | ||
diff --git a/test/cuchaz/enigma/TestJarIndexLoneClass.java b/test/cuchaz/enigma/TestJarIndexLoneClass.java index 2889241f..c97b2efa 100644 --- a/test/cuchaz/enigma/TestJarIndexLoneClass.java +++ b/test/cuchaz/enigma/TestJarIndexLoneClass.java | |||
| @@ -52,10 +52,10 @@ public class TestJarIndexLoneClass { | |||
| 52 | 52 | ||
| 53 | @Test | 53 | @Test |
| 54 | public void translationIndex() { | 54 | public void translationIndex() { |
| 55 | assertThat(m_index.getTranslationIndex().getSuperclass(new ClassEntry("none/a")), is(nullValue())); | 55 | assertThat(m_index.getTranslationIndex().getSuperclass(new ClassEntry("none/a")), is(new ClassEntry("java/lang/Object"))); |
| 56 | assertThat(m_index.getTranslationIndex().getSuperclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(nullValue())); | 56 | assertThat(m_index.getTranslationIndex().getSuperclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(new ClassEntry("java/lang/Object"))); |
| 57 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("none/a")), is(empty())); | 57 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("none/a")), contains(new ClassEntry("java/lang/Object"))); |
| 58 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); | 58 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("cuchaz/enigma/inputs/Keep")), contains(new ClassEntry("java/lang/Object"))); |
| 59 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("none/a")), is(empty())); | 59 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("none/a")), is(empty())); |
| 60 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); | 60 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); |
| 61 | } | 61 | } |
| @@ -152,7 +152,7 @@ public class TestJarIndexLoneClass { | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | @Test | 154 | @Test |
| 155 | public void contains() { | 155 | public void testContains() { |
| 156 | assertThat(m_index.containsObfClass(newClass("none/a")), is(true)); | 156 | assertThat(m_index.containsObfClass(newClass("none/a")), is(true)); |
| 157 | assertThat(m_index.containsObfClass(newClass("none/b")), is(false)); | 157 | assertThat(m_index.containsObfClass(newClass("none/b")), is(false)); |
| 158 | assertThat(m_index.containsObfField(newField("none/a", "a", "Ljava/lang/String;")), is(true)); | 158 | assertThat(m_index.containsObfField(newField("none/a", "a", "Ljava/lang/String;")), is(true)); |