blob: 5f11721336c2a418f30f2625a1b584d4b0791f22 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*******************************************************************************
* Copyright (c) 2015 Jeff Martin.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public
* License v3.0 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl.html
*
* Contributors:
* Jeff Martin - initial API and implementation
******************************************************************************/
package cuchaz.enigma;
import com.google.common.collect.Lists;
import cuchaz.enigma.translation.representation.entry.ClassEntry;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import java.util.jar.JarFile;
import static org.junit.Assert.assertEquals;
public class TestDeobfuscator {
private Deobfuscator getDeobfuscator()
throws IOException {
return new Deobfuscator(new JarFile("build/test-obf/loneClass.jar"));
}
@Test
public void loadJar()
throws Exception {
getDeobfuscator();
}
@Test
public void getClasses()
throws Exception {
Deobfuscator deobfuscator = getDeobfuscator();
List<ClassEntry> obfClasses = Lists.newArrayList();
List<ClassEntry> deobfClasses = Lists.newArrayList();
deobfuscator.getSeparatedClasses(obfClasses, deobfClasses);
assertEquals(1, obfClasses.size());
assertEquals("a", obfClasses.get(0).getName());
assertEquals(1, deobfClasses.size());
assertEquals("cuchaz/enigma/inputs/Keep", deobfClasses.get(0).getName());
}
@Test
public void decompileClass()
throws Exception {
Deobfuscator deobfuscator = getDeobfuscator();
deobfuscator.getSource(deobfuscator.getSourceTree("a"));
}
}
|