diff options
| author | 2019-06-16 23:49:25 +0200 | |
|---|---|---|
| committer | 2019-06-16 23:49:25 +0200 | |
| commit | e27d5967029f4f3da8889dd673ba516dcd9f3ac8 (patch) | |
| tree | 71c98afad01cafdb2884da288e494e8761c2a8ff /src/test/java/cuchaz/enigma/TestDeobfed.java | |
| parent | Merge remote-tracking branch 'origin/master' into proposal-tweak (diff) | |
| download | enigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.tar.gz enigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.tar.xz enigma-fork-e27d5967029f4f3da8889dd673ba516dcd9f3ac8.zip | |
Plugin rework along with API rework: Enigma split from EnigmaProject; plugins now provide services configurable via a profile
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestDeobfed.java')
| -rw-r--r-- | src/test/java/cuchaz/enigma/TestDeobfed.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/test/java/cuchaz/enigma/TestDeobfed.java b/src/test/java/cuchaz/enigma/TestDeobfed.java index 14b1418..3d875df 100644 --- a/src/test/java/cuchaz/enigma/TestDeobfed.java +++ b/src/test/java/cuchaz/enigma/TestDeobfed.java | |||
| @@ -11,12 +11,12 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.analysis.ParsedJar; | 14 | import cuchaz.enigma.analysis.ClassCache; |
| 15 | import cuchaz.enigma.analysis.index.JarIndex; | 15 | import cuchaz.enigma.analysis.index.JarIndex; |
| 16 | import org.junit.BeforeClass; | 16 | import org.junit.BeforeClass; |
| 17 | import org.junit.Test; | 17 | import org.junit.Test; |
| 18 | 18 | ||
| 19 | import java.util.jar.JarFile; | 19 | import java.nio.file.Paths; |
| 20 | 20 | ||
| 21 | import static cuchaz.enigma.TestEntryFactory.newClass; | 21 | import static cuchaz.enigma.TestEntryFactory.newClass; |
| 22 | import static org.hamcrest.MatcherAssert.assertThat; | 22 | import static org.hamcrest.MatcherAssert.assertThat; |
| @@ -24,15 +24,16 @@ import static org.hamcrest.Matchers.containsInAnyOrder; | |||
| 24 | 24 | ||
| 25 | public class TestDeobfed { | 25 | public class TestDeobfed { |
| 26 | 26 | ||
| 27 | private static ParsedJar jar; | 27 | private static Enigma enigma; |
| 28 | private static ClassCache classCache; | ||
| 28 | private static JarIndex index; | 29 | private static JarIndex index; |
| 29 | 30 | ||
| 30 | @BeforeClass | 31 | @BeforeClass |
| 31 | public static void beforeClass() | 32 | public static void beforeClass() throws Exception { |
| 32 | throws Exception { | 33 | enigma = Enigma.create(); |
| 33 | jar = new ParsedJar(new JarFile("build/test-deobf/translation.jar")); | 34 | |
| 34 | index = JarIndex.empty(); | 35 | classCache = ClassCache.of(Paths.get("build/test-deobf/translation.jar")); |
| 35 | index.indexJar(jar, s -> {}); | 36 | index = classCache.index(ProgressListener.none()); |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | @Test | 39 | @Test |
| @@ -67,8 +68,9 @@ public class TestDeobfed { | |||
| 67 | @Test | 68 | @Test |
| 68 | public void decompile() | 69 | public void decompile() |
| 69 | throws Exception { | 70 | throws Exception { |
| 70 | Deobfuscator deobfuscator = new Deobfuscator(jar); | 71 | EnigmaProject project = new EnigmaProject(enigma, classCache, index); |
| 71 | SourceProvider sourceProvider = deobfuscator.getObfSourceProvider(); | 72 | |
| 73 | SourceProvider sourceProvider = project.getObfSourceProvider(); | ||
| 72 | sourceProvider.getSources("a"); | 74 | sourceProvider.getSources("a"); |
| 73 | sourceProvider.getSources("b"); | 75 | sourceProvider.getSources("b"); |
| 74 | sourceProvider.getSources("c"); | 76 | sourceProvider.getSources("c"); |