diff options
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java')
| -rw-r--r-- | src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java b/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java index 65af6d8..8efa57c 100644 --- a/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java +++ b/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java | |||
| @@ -34,17 +34,17 @@ import cuchaz.enigma.mapping.Translator; | |||
| 34 | 34 | ||
| 35 | public class TestJarIndexLoneClass { | 35 | public class TestJarIndexLoneClass { |
| 36 | 36 | ||
| 37 | private JarIndex m_index; | 37 | private JarIndex index; |
| 38 | 38 | ||
| 39 | public TestJarIndexLoneClass() | 39 | public TestJarIndexLoneClass() |
| 40 | throws Exception { | 40 | throws Exception { |
| 41 | m_index = new JarIndex(); | 41 | index = new JarIndex(); |
| 42 | m_index.indexJar(new JarFile("build/test-obf/loneClass.jar"), false); | 42 | index.indexJar(new JarFile("build/test-obf/loneClass.jar"), false); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | @Test | 45 | @Test |
| 46 | public void obfEntries() { | 46 | public void obfEntries() { |
| 47 | assertThat(m_index.getObfClassEntries(), containsInAnyOrder( | 47 | assertThat(index.getObfClassEntries(), containsInAnyOrder( |
| 48 | newClass("cuchaz/enigma/inputs/Keep"), | 48 | newClass("cuchaz/enigma/inputs/Keep"), |
| 49 | newClass("a") | 49 | newClass("a") |
| 50 | )); | 50 | )); |
| @@ -52,25 +52,25 @@ 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("a")), is(new ClassEntry("java/lang/Object"))); | 55 | assertThat(index.getTranslationIndex().getSuperclass(new ClassEntry("a")), is(new ClassEntry("java/lang/Object"))); |
| 56 | assertThat(m_index.getTranslationIndex().getSuperclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(new ClassEntry("java/lang/Object"))); | 56 | assertThat(index.getTranslationIndex().getSuperclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(new ClassEntry("java/lang/Object"))); |
| 57 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("a")), contains(new ClassEntry("java/lang/Object"))); | 57 | assertThat(index.getTranslationIndex().getAncestry(new ClassEntry("a")), contains(new ClassEntry("java/lang/Object"))); |
| 58 | assertThat(m_index.getTranslationIndex().getAncestry(new ClassEntry("cuchaz/enigma/inputs/Keep")), contains(new ClassEntry("java/lang/Object"))); | 58 | assertThat(index.getTranslationIndex().getAncestry(new ClassEntry("cuchaz/enigma/inputs/Keep")), contains(new ClassEntry("java/lang/Object"))); |
| 59 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("a")), is(empty())); | 59 | assertThat(index.getTranslationIndex().getSubclass(new ClassEntry("a")), is(empty())); |
| 60 | assertThat(m_index.getTranslationIndex().getSubclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); | 60 | assertThat(index.getTranslationIndex().getSubclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | @Test | 63 | @Test |
| 64 | public void access() { | 64 | public void access() { |
| 65 | assertThat(m_index.getAccess(newField("a", "a", "Ljava/lang/String;")), is(Access.Private)); | 65 | assertThat(index.getAccess(newField("a", "a", "Ljava/lang/String;")), is(Access.PRIVATE)); |
| 66 | assertThat(m_index.getAccess(newMethod("a", "a", "()Ljava/lang/String;")), is(Access.Public)); | 66 | assertThat(index.getAccess(newMethod("a", "a", "()Ljava/lang/String;")), is(Access.PUBLIC)); |
| 67 | assertThat(m_index.getAccess(newField("a", "b", "Ljava/lang/String;")), is(nullValue())); | 67 | assertThat(index.getAccess(newField("a", "b", "Ljava/lang/String;")), is(nullValue())); |
| 68 | assertThat(m_index.getAccess(newField("a", "a", "LFoo;")), is(nullValue())); | 68 | assertThat(index.getAccess(newField("a", "a", "LFoo;")), is(nullValue())); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | @Test | 71 | @Test |
| 72 | public void classInheritance() { | 72 | public void classInheritance() { |
| 73 | ClassInheritanceTreeNode node = m_index.getClassInheritance(new Translator(), newClass("a")); | 73 | ClassInheritanceTreeNode node = index.getClassInheritance(new Translator(), newClass("a")); |
| 74 | assertThat(node, is(not(nullValue()))); | 74 | assertThat(node, is(not(nullValue()))); |
| 75 | assertThat(node.getObfClassName(), is("a")); | 75 | assertThat(node.getObfClassName(), is("a")); |
| 76 | assertThat(node.getChildCount(), is(0)); | 76 | assertThat(node.getChildCount(), is(0)); |
| @@ -79,7 +79,7 @@ public class TestJarIndexLoneClass { | |||
| 79 | @Test | 79 | @Test |
| 80 | public void methodInheritance() { | 80 | public void methodInheritance() { |
| 81 | MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); | 81 | MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); |
| 82 | MethodInheritanceTreeNode node = m_index.getMethodInheritance(new Translator(), source); | 82 | MethodInheritanceTreeNode node = index.getMethodInheritance(new Translator(), source); |
| 83 | assertThat(node, is(not(nullValue()))); | 83 | assertThat(node, is(not(nullValue()))); |
| 84 | assertThat(node.getMethodEntry(), is(source)); | 84 | assertThat(node.getMethodEntry(), is(source)); |
| 85 | assertThat(node.getChildCount(), is(0)); | 85 | assertThat(node.getChildCount(), is(0)); |
| @@ -87,19 +87,19 @@ public class TestJarIndexLoneClass { | |||
| 87 | 87 | ||
| 88 | @Test | 88 | @Test |
| 89 | public void classImplementations() { | 89 | public void classImplementations() { |
| 90 | ClassImplementationsTreeNode node = m_index.getClassImplementations(new Translator(), newClass("a")); | 90 | ClassImplementationsTreeNode node = index.getClassImplementations(new Translator(), newClass("a")); |
| 91 | assertThat(node, is(nullValue())); | 91 | assertThat(node, is(nullValue())); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | @Test | 94 | @Test |
| 95 | public void methodImplementations() { | 95 | public void methodImplementations() { |
| 96 | MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); | 96 | MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); |
| 97 | assertThat(m_index.getMethodImplementations(new Translator(), source), is(empty())); | 97 | assertThat(index.getMethodImplementations(new Translator(), source), is(empty())); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | @Test | 100 | @Test |
| 101 | public void relatedMethodImplementations() { | 101 | public void relatedMethodImplementations() { |
| 102 | Set<MethodEntry> entries = m_index.getRelatedMethodImplementations(newMethod("a", "a", "()Ljava/lang/String;")); | 102 | Set<MethodEntry> entries = index.getRelatedMethodImplementations(newMethod("a", "a", "()Ljava/lang/String;")); |
| 103 | assertThat(entries, containsInAnyOrder( | 103 | assertThat(entries, containsInAnyOrder( |
| 104 | newMethod("a", "a", "()Ljava/lang/String;") | 104 | newMethod("a", "a", "()Ljava/lang/String;") |
| 105 | )); | 105 | )); |
| @@ -109,7 +109,7 @@ public class TestJarIndexLoneClass { | |||
| 109 | @SuppressWarnings("unchecked") | 109 | @SuppressWarnings("unchecked") |
| 110 | public void fieldReferences() { | 110 | public void fieldReferences() { |
| 111 | FieldEntry source = newField("a", "a", "Ljava/lang/String;"); | 111 | FieldEntry source = newField("a", "a", "Ljava/lang/String;"); |
| 112 | Collection<EntryReference<FieldEntry,BehaviorEntry>> references = m_index.getFieldReferences(source); | 112 | Collection<EntryReference<FieldEntry,BehaviorEntry>> references = index.getFieldReferences(source); |
| 113 | assertThat(references, containsInAnyOrder( | 113 | assertThat(references, containsInAnyOrder( |
| 114 | newFieldReferenceByConstructor(source, "a", "(Ljava/lang/String;)V"), | 114 | newFieldReferenceByConstructor(source, "a", "(Ljava/lang/String;)V"), |
| 115 | newFieldReferenceByMethod(source, "a", "a", "()Ljava/lang/String;") | 115 | newFieldReferenceByMethod(source, "a", "a", "()Ljava/lang/String;") |
| @@ -118,47 +118,47 @@ public class TestJarIndexLoneClass { | |||
| 118 | 118 | ||
| 119 | @Test | 119 | @Test |
| 120 | public void behaviorReferences() { | 120 | public void behaviorReferences() { |
| 121 | assertThat(m_index.getBehaviorReferences(newMethod("a", "a", "()Ljava/lang/String;")), is(empty())); | 121 | assertThat(index.getBehaviorReferences(newMethod("a", "a", "()Ljava/lang/String;")), is(empty())); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | @Test | 124 | @Test |
| 125 | public void innerClasses() { | 125 | public void innerClasses() { |
| 126 | assertThat(m_index.getInnerClasses(newClass("a")), is(empty())); | 126 | assertThat(index.getInnerClasses(newClass("a")), is(empty())); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | @Test | 129 | @Test |
| 130 | public void outerClass() { | 130 | public void outerClass() { |
| 131 | assertThat(m_index.getOuterClass(newClass("a")), is(nullValue())); | 131 | assertThat(index.getOuterClass(newClass("a")), is(nullValue())); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | @Test | 134 | @Test |
| 135 | public void isAnonymousClass() { | 135 | public void isAnonymousClass() { |
| 136 | assertThat(m_index.isAnonymousClass(newClass("a")), is(false)); | 136 | assertThat(index.isAnonymousClass(newClass("a")), is(false)); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | @Test | 139 | @Test |
| 140 | public void interfaces() { | 140 | public void interfaces() { |
| 141 | assertThat(m_index.getInterfaces("a"), is(empty())); | 141 | assertThat(index.getInterfaces("a"), is(empty())); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | @Test | 144 | @Test |
| 145 | public void implementingClasses() { | 145 | public void implementingClasses() { |
| 146 | assertThat(m_index.getImplementingClasses("a"), is(empty())); | 146 | assertThat(index.getImplementingClasses("a"), is(empty())); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | @Test | 149 | @Test |
| 150 | public void isInterface() { | 150 | public void isInterface() { |
| 151 | assertThat(m_index.isInterface("a"), is(false)); | 151 | assertThat(index.isInterface("a"), is(false)); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | @Test | 154 | @Test |
| 155 | public void testContains() { | 155 | public void testContains() { |
| 156 | assertThat(m_index.containsObfClass(newClass("a")), is(true)); | 156 | assertThat(index.containsObfClass(newClass("a")), is(true)); |
| 157 | assertThat(m_index.containsObfClass(newClass("b")), is(false)); | 157 | assertThat(index.containsObfClass(newClass("b")), is(false)); |
| 158 | assertThat(m_index.containsObfField(newField("a", "a", "Ljava/lang/String;")), is(true)); | 158 | assertThat(index.containsObfField(newField("a", "a", "Ljava/lang/String;")), is(true)); |
| 159 | assertThat(m_index.containsObfField(newField("a", "b", "Ljava/lang/String;")), is(false)); | 159 | assertThat(index.containsObfField(newField("a", "b", "Ljava/lang/String;")), is(false)); |
| 160 | assertThat(m_index.containsObfField(newField("a", "a", "LFoo;")), is(false)); | 160 | assertThat(index.containsObfField(newField("a", "a", "LFoo;")), is(false)); |
| 161 | assertThat(m_index.containsObfBehavior(newMethod("a", "a", "()Ljava/lang/String;")), is(true)); | 161 | assertThat(index.containsObfBehavior(newMethod("a", "a", "()Ljava/lang/String;")), is(true)); |
| 162 | assertThat(m_index.containsObfBehavior(newMethod("a", "b", "()Ljava/lang/String;")), is(false)); | 162 | assertThat(index.containsObfBehavior(newMethod("a", "b", "()Ljava/lang/String;")), is(false)); |
| 163 | } | 163 | } |
| 164 | } | 164 | } |