use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTypeResolver2 method test.
@Test
public void test() {
noDebugInfo();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("if (obj != null) {"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestRedundantThis method test.
// @Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, not(containsString("this.f1();")));
assertThat(code, not(containsString("return this.field1;")));
assertThat(code, containsString("this.field2 = field2;"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestFieldInit method test.
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("List<String> s = new ArrayList"));
assertThat(code, containsOne("A a = new A();"));
assertThat(code, containsOne("int i = (Random.class.getSimpleName().length() + 1);"));
assertThat(code, containsOne("int n = 0;"));
assertThat(code, not(containsString("static {")));
assertThat(code, containsOne("this.n = z;"));
assertThat(code, containsOne("this.n = 0;"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestFieldInitInTryCatch method test.
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("private static final URL a;"));
assertThat(code, containsOne("a = new URL(\"http://www.example.com/\");"));
assertThat(code, containsLines(2, "try {", indent(1) + "a = new URL(\"http://www.example.com/\");", "} catch (MalformedURLException e) {"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestIfInTry method test.
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("if (a != 0) {"));
assertThat(code, containsOne("} catch (Exception e) {"));
assertThat(code, countString(2, "try {"));
assertThat(code, countString(3, "f()"));
assertThat(code, containsOne("return 1;"));
assertThat(code, containsOne("} catch (IOException e"));
assertThat(code, containsOne("return -1;"));
}
Aggregations