diff options
| author | 2019-06-19 18:51:31 +0100 | |
|---|---|---|
| committer | 2019-06-19 18:51:31 +0100 | |
| commit | 546c617598b10c341fe6549678803f6ac0c95619 (patch) | |
| tree | d818bcebf7634ed5b716ee29619725fdc29a04e8 /src/test/java/cuchaz/enigma/TestDeobfed.java | |
| parent | fix unwanted declaration navigation during Quick Find (diff) | |
| parent | Parse profile json from cli args (diff) | |
| download | enigma-fork-546c617598b10c341fe6549678803f6ac0c95619.tar.gz enigma-fork-546c617598b10c341fe6549678803f6ac0c95619.tar.xz enigma-fork-546c617598b10c341fe6549678803f6ac0c95619.zip | |
Merge pull request #135 from gegy1000/proposal-tweak
Plugin rework
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestDeobfed.java')
| -rw-r--r-- | src/test/java/cuchaz/enigma/TestDeobfed.java | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/test/java/cuchaz/enigma/TestDeobfed.java b/src/test/java/cuchaz/enigma/TestDeobfed.java index 14b1418..3ee86cb 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 |
| @@ -65,10 +66,12 @@ public class TestDeobfed { | |||
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | @Test | 68 | @Test |
| 68 | public void decompile() | 69 | public void decompile() { |
| 69 | throws Exception { | 70 | EnigmaProject project = new EnigmaProject(enigma, classCache, index); |
| 70 | Deobfuscator deobfuscator = new Deobfuscator(jar); | 71 | |
| 71 | SourceProvider sourceProvider = deobfuscator.getObfSourceProvider(); | 72 | CompiledSourceTypeLoader typeLoader = new CompiledSourceTypeLoader(project.getClassCache()); |
| 73 | SourceProvider sourceProvider = new SourceProvider(SourceProvider.createSettings(), typeLoader); | ||
| 74 | |||
| 72 | sourceProvider.getSources("a"); | 75 | sourceProvider.getSources("a"); |
| 73 | sourceProvider.getSources("b"); | 76 | sourceProvider.getSources("b"); |
| 74 | sourceProvider.getSources("c"); | 77 | sourceProvider.getSources("c"); |