Search in sources :

Example 76 with ClassNode

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

the class TestEnumsWithConsts method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsLines(1, "public enum Direction {", indent(1) + "NORTH,", indent(1) + "SOUTH,", indent(1) + "EAST,", indent(1) + "WEST", "}"));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 77 with ClassNode

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

the class TestSwitchOverEnum2 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestSwitchOverEnum2.class);
    String code = cls.getCode().toString();
    assertThat(code, countString(1, "synthetic"));
    assertThat(code, countString(2, "switch (c) {"));
    assertThat(code, countString(2, "case ONE:"));
    assertThat(code, countString(2, "case DOG:"));
}
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 78 with ClassNode

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

the class TestGenerics method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsString("mthWildcard(List<?> list)"));
    assertThat(code, containsString("mthExtends(List<? extends A> list)"));
    assertThat(code, containsString("mthSuper(List<? super A> list)"));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 79 with ClassNode

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

the class TestGenerics3 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsString("mthExtendsArray(List<? extends byte[]> list)"));
    assertThat(code, containsString("mthSuperArray(List<? super int[]> list)"));
    assertThat(code, containsString("mthSuperInteger(List<? super Integer> list)"));
    assertThat(code, containsString("mthExtendsString(List<? super String> list)"));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) IntegrationTest(jadx.tests.api.IntegrationTest) Test(org.junit.Test)

Example 80 with ClassNode

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

the class TestGenerics4 method test.

@Test
public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();
    assertThat(code, containsString("Class<?>[] a ="));
    assertThat(code, not(containsString("Class[] a =")));
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) CoreMatchers.containsString(org.hamcrest.CoreMatchers.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