Search in sources :

Example 96 with ClassNode

use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.

the class TestAnonymousClass4 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsOne(indent(3) + "new Thread() {"));
    assertThat(code, containsOne(indent(4) + "{"));
    assertThat(code, containsOne("f = 1;"));
    assertThat(code, countString(2, indent(4) + "}"));
    assertThat(code, containsOne(indent(4) + "public void run() {"));
    assertThat(code, containsOne("d = 7.5"));
    assertThat(code, containsOne(indent(3) + "}.start();"));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) JadxMatchers.countString(jadx.tests.api.utils.JadxMatchers.countString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 97 with ClassNode

use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.

the class TestAnonymousClass5 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsOne("map.get(name);"));
    assertThat(code, not(containsString("access$008")));
// TODO
//		assertThat(code, not(containsString("synthetic")));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) Matchers.containsString(org.hamcrest.Matchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 98 with ClassNode

use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.

the class TestAnonymousClass6 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsOne("public Runnable test(final double d) {"));
    assertThat(code, containsOne("return new Runnable() {"));
    assertThat(code, containsOne("public void run() {"));
    assertThat(code, containsOne("System.out.println(d);"));
    assertThat(code, not(containsString("synthetic")));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) Matchers.containsString(org.hamcrest.Matchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 99 with ClassNode

use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.

the class TestAnonymousClass7 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsOne("public static Runnable test(final double d) {"));
    assertThat(code, containsOne("return new Runnable() {"));
    assertThat(code, containsOne("public void run() {"));
    assertThat(code, containsOne("System.out.println(d);"));
    assertThat(code, not(containsString("synthetic")));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) Matchers.containsString(org.hamcrest.Matchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 100 with ClassNode

use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.

the class TestAnonymousClass8 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsOne("public Runnable test() {"));
    assertThat(code, containsOne("return new Runnable() {"));
    assertThat(code, containsOne("public void run() {"));
    assertThat(code, containsOne("this.d);"));
    assertThat(code, not(containsString("synthetic")));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) Matchers.containsString(org.hamcrest.Matchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Aggregations

ClassNode (jadx.core.dex.nodes.ClassNode)236 Test (org.junit.Test)201 IntegrationTest (jadx.tests.api.IntegrationTest)197 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)93 JadxMatchers.countString (jadx.tests.api.utils.JadxMatchers.countString)17 MethodNode (jadx.core.dex.nodes.MethodNode)12 FieldNode (jadx.core.dex.nodes.FieldNode)10 Matchers.containsString (org.hamcrest.Matchers.containsString)10 ConstClassNode (jadx.core.dex.instructions.ConstClassNode)7 InsnNode (jadx.core.dex.nodes.InsnNode)7 ClassInfo (jadx.core.dex.info.ClassInfo)6 IndexInsnNode (jadx.core.dex.instructions.IndexInsnNode)6 DexNode (jadx.core.dex.nodes.DexNode)5 InsnArg (jadx.core.dex.instructions.args.InsnArg)4 ConstructorInsn (jadx.core.dex.instructions.mods.ConstructorInsn)4 SmaliTest (jadx.tests.api.SmaliTest)4 ArrayList (java.util.ArrayList)4 FieldReplaceAttr (jadx.core.dex.attributes.nodes.FieldReplaceAttr)3 FieldInfo (jadx.core.dex.info.FieldInfo)3 MethodInfo (jadx.core.dex.info.MethodInfo)3