diff options
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java')
| -rw-r--r-- | src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java b/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java index 763639a..c3f3b66 100644 --- a/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java +++ b/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java | |||
| @@ -12,12 +12,11 @@ | |||
| 12 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.analysis.EntryReference; | 14 | import cuchaz.enigma.analysis.EntryReference; |
| 15 | import cuchaz.enigma.analysis.JarIndex; | ||
| 16 | import cuchaz.enigma.analysis.ParsedJar; | 15 | import cuchaz.enigma.analysis.ParsedJar; |
| 17 | import cuchaz.enigma.mapping.entry.ClassEntry; | 16 | import cuchaz.enigma.analysis.index.JarIndex; |
| 18 | import cuchaz.enigma.mapping.entry.MethodDefEntry; | 17 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 19 | import cuchaz.enigma.mapping.entry.MethodEntry; | 18 | import cuchaz.enigma.translation.representation.entry.MethodDefEntry; |
| 20 | import cuchaz.enigma.mapping.entry.ReferencedEntryPool; | 19 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 21 | import org.junit.Test; | 20 | import org.junit.Test; |
| 22 | 21 | ||
| 23 | import java.io.File; | 22 | import java.io.File; |
| @@ -41,13 +40,13 @@ public class TestJarIndexConstructorReferences { | |||
| 41 | public TestJarIndexConstructorReferences() | 40 | public TestJarIndexConstructorReferences() |
| 42 | throws Exception { | 41 | throws Exception { |
| 43 | File jarFile = new File("build/test-obf/constructors.jar"); | 42 | File jarFile = new File("build/test-obf/constructors.jar"); |
| 44 | index = new JarIndex(new ReferencedEntryPool()); | 43 | index = JarIndex.empty(); |
| 45 | index.indexJar(new ParsedJar(new JarFile(jarFile)), false); | 44 | index.indexJar(new ParsedJar(new JarFile(jarFile)), s -> {}); |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | @Test | 47 | @Test |
| 49 | public void obfEntries() { | 48 | public void obfEntries() { |
| 50 | assertThat(index.getObfClassEntries(), containsInAnyOrder(newClass("cuchaz/enigma/inputs/Keep"), baseClass, | 49 | assertThat(index.getEntryIndex().getClasses(), containsInAnyOrder(newClass("cuchaz/enigma/inputs/Keep"), baseClass, |
| 51 | subClass, subsubClass, defaultClass, callerClass)); | 50 | subClass, subsubClass, defaultClass, callerClass)); |
| 52 | } | 51 | } |
| 53 | 52 | ||
| @@ -55,7 +54,7 @@ public class TestJarIndexConstructorReferences { | |||
| 55 | @SuppressWarnings("unchecked") | 54 | @SuppressWarnings("unchecked") |
| 56 | public void baseDefault() { | 55 | public void baseDefault() { |
| 57 | MethodEntry source = newMethod(baseClass, "<init>", "()V"); | 56 | MethodEntry source = newMethod(baseClass, "<init>", "()V"); |
| 58 | Collection<EntryReference<MethodEntry, MethodDefEntry>> references = index.getMethodsReferencing(source); | 57 | Collection<EntryReference<MethodEntry, MethodDefEntry>> references = index.getReferenceIndex().getReferencesToMethod(source); |
| 59 | assertThat(references, containsInAnyOrder( | 58 | assertThat(references, containsInAnyOrder( |
| 60 | newBehaviorReferenceByMethod(source, callerClass.getName(), "a", "()V"), | 59 | newBehaviorReferenceByMethod(source, callerClass.getName(), "a", "()V"), |
| 61 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "()V"), | 60 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "()V"), |
| @@ -67,7 +66,7 @@ public class TestJarIndexConstructorReferences { | |||
| 67 | @SuppressWarnings("unchecked") | 66 | @SuppressWarnings("unchecked") |
| 68 | public void baseInt() { | 67 | public void baseInt() { |
| 69 | MethodEntry source = newMethod(baseClass, "<init>", "(I)V"); | 68 | MethodEntry source = newMethod(baseClass, "<init>", "(I)V"); |
| 70 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 69 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 71 | newBehaviorReferenceByMethod(source, callerClass.getName(), "b", "()V") | 70 | newBehaviorReferenceByMethod(source, callerClass.getName(), "b", "()V") |
| 72 | )); | 71 | )); |
| 73 | } | 72 | } |
| @@ -76,7 +75,7 @@ public class TestJarIndexConstructorReferences { | |||
| 76 | @SuppressWarnings("unchecked") | 75 | @SuppressWarnings("unchecked") |
| 77 | public void subDefault() { | 76 | public void subDefault() { |
| 78 | MethodEntry source = newMethod(subClass, "<init>", "()V"); | 77 | MethodEntry source = newMethod(subClass, "<init>", "()V"); |
| 79 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 78 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 80 | newBehaviorReferenceByMethod(source, callerClass.getName(), "c", "()V"), | 79 | newBehaviorReferenceByMethod(source, callerClass.getName(), "c", "()V"), |
| 81 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "(I)V") | 80 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "(I)V") |
| 82 | )); | 81 | )); |
| @@ -86,7 +85,7 @@ public class TestJarIndexConstructorReferences { | |||
| 86 | @SuppressWarnings("unchecked") | 85 | @SuppressWarnings("unchecked") |
| 87 | public void subInt() { | 86 | public void subInt() { |
| 88 | MethodEntry source = newMethod(subClass, "<init>", "(I)V"); | 87 | MethodEntry source = newMethod(subClass, "<init>", "(I)V"); |
| 89 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 88 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 90 | newBehaviorReferenceByMethod(source, callerClass.getName(), "d", "()V"), | 89 | newBehaviorReferenceByMethod(source, callerClass.getName(), "d", "()V"), |
| 91 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "(II)V"), | 90 | newBehaviorReferenceByMethod(source, subClass.getName(), "<init>", "(II)V"), |
| 92 | newBehaviorReferenceByMethod(source, subsubClass.getName(), "<init>", "(I)V") | 91 | newBehaviorReferenceByMethod(source, subsubClass.getName(), "<init>", "(I)V") |
| @@ -97,7 +96,7 @@ public class TestJarIndexConstructorReferences { | |||
| 97 | @SuppressWarnings("unchecked") | 96 | @SuppressWarnings("unchecked") |
| 98 | public void subIntInt() { | 97 | public void subIntInt() { |
| 99 | MethodEntry source = newMethod(subClass, "<init>", "(II)V"); | 98 | MethodEntry source = newMethod(subClass, "<init>", "(II)V"); |
| 100 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 99 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 101 | newBehaviorReferenceByMethod(source, callerClass.getName(), "e", "()V") | 100 | newBehaviorReferenceByMethod(source, callerClass.getName(), "e", "()V") |
| 102 | )); | 101 | )); |
| 103 | } | 102 | } |
| @@ -105,14 +104,14 @@ public class TestJarIndexConstructorReferences { | |||
| 105 | @Test | 104 | @Test |
| 106 | public void subIntIntInt() { | 105 | public void subIntIntInt() { |
| 107 | MethodEntry source = newMethod(subClass, "<init>", "(III)V"); | 106 | MethodEntry source = newMethod(subClass, "<init>", "(III)V"); |
| 108 | assertThat(index.getMethodsReferencing(source), is(empty())); | 107 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), is(empty())); |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | @Test | 110 | @Test |
| 112 | @SuppressWarnings("unchecked") | 111 | @SuppressWarnings("unchecked") |
| 113 | public void subsubInt() { | 112 | public void subsubInt() { |
| 114 | MethodEntry source = newMethod(subsubClass, "<init>", "(I)V"); | 113 | MethodEntry source = newMethod(subsubClass, "<init>", "(I)V"); |
| 115 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 114 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 116 | newBehaviorReferenceByMethod(source, callerClass.getName(), "f", "()V") | 115 | newBehaviorReferenceByMethod(source, callerClass.getName(), "f", "()V") |
| 117 | )); | 116 | )); |
| 118 | } | 117 | } |
| @@ -121,7 +120,7 @@ public class TestJarIndexConstructorReferences { | |||
| 121 | @SuppressWarnings("unchecked") | 120 | @SuppressWarnings("unchecked") |
| 122 | public void defaultConstructable() { | 121 | public void defaultConstructable() { |
| 123 | MethodEntry source = newMethod(defaultClass, "<init>", "()V"); | 122 | MethodEntry source = newMethod(defaultClass, "<init>", "()V"); |
| 124 | assertThat(index.getMethodsReferencing(source), containsInAnyOrder( | 123 | assertThat(index.getReferenceIndex().getReferencesToMethod(source), containsInAnyOrder( |
| 125 | newBehaviorReferenceByMethod(source, callerClass.getName(), "g", "()V") | 124 | newBehaviorReferenceByMethod(source, callerClass.getName(), "g", "()V") |
| 126 | )); | 125 | )); |
| 127 | } | 126 | } |