use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTryCatch3 method test.
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsString("try {"));
assertThat(code, containsString("exc(obj);"));
assertThat(code, containsString("} catch (Exception e) {"));
assertThat(code, not(containsString("throw th;")));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTryCatch4 method test.
@Test
public void test() {
disableCompilation();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsString("try {"));
assertThat(code, containsString("output = new FileOutputStream(new File(\"f\"));"));
assertThat(code, containsString("return new Object();"));
assertThat(code, containsString("} catch (FileNotFoundException e) {"));
assertThat(code, containsString("System.out.println(\"Exception\");"));
assertThat(code, containsString("return null;"));
assertThat(code, not(containsString("output = output;")));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTryCatch6 method test.
@Test
public void test() {
noDebugInfo();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("try {"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTryCatch7 method test.
@Test
public void test() {
noDebugInfo();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
String excVarName = "exception";
assertThat(code, containsOne("Exception " + excVarName + " = new Exception();"));
assertThat(code, containsOne("} catch (Exception e) {"));
assertThat(code, containsOne(excVarName + " = e;"));
assertThat(code, containsOne(excVarName + ".printStackTrace();"));
assertThat(code, containsOne("return " + excVarName + ";"));
}
use of jadx.core.dex.nodes.ClassNode in project jadx by skylot.
the class TestTryCatch8 method test.
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("synchronized (this) {"));
assertThat(code, containsOne("throw new MyException();"));
assertThat(code, containsOne("} catch (MyException e) {"));
assertThat(code, containsOne("this.e = e;"));
assertThat(code, containsOne("} catch (Exception x) {"));
assertThat(code, containsOne("this.e = new MyException(\"MyExc\", x);"));
}
Aggregations