diff options
| author | 2015-05-24 11:23:36 -0400 | |
|---|---|---|
| committer | 2015-05-24 11:23:36 -0400 | |
| commit | c7a3de184dc51526ee157d47981a74ffba284f5d (patch) | |
| tree | cd6741dccaea95e760632db3f60fec378949602e /test/cuchaz/enigma/TestJarIndexInheritanceTree.java | |
| parent | relicense Enigma as LGPL (diff) | |
| download | enigma-fork-c7a3de184dc51526ee157d47981a74ffba284f5d.tar.gz enigma-fork-c7a3de184dc51526ee157d47981a74ffba284f5d.tar.xz enigma-fork-c7a3de184dc51526ee157d47981a74ffba284f5d.zip | |
fix broken tests, and one broken function. =)
Diffstat (limited to '')
| -rw-r--r-- | test/cuchaz/enigma/TestJarIndexInheritanceTree.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/test/cuchaz/enigma/TestJarIndexInheritanceTree.java b/test/cuchaz/enigma/TestJarIndexInheritanceTree.java index 04d4fb2..d3c23ea 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 | ||