■ ■ ■ ■ ■ ■
jadx-core/src/test/java/jadx/tests/internal/TestTmp2.java
| 1 | + | package jadx.tests.internal; |
| 2 | + | |
| 3 | + | import jadx.api.InternalJadxTest; |
| 4 | + | import jadx.core.dex.nodes.ClassNode; |
| 5 | + | |
| 6 | + | import org.junit.Test; |
| 7 | + | |
| 8 | + | import static org.hamcrest.CoreMatchers.containsString; |
| 9 | + | import static org.hamcrest.CoreMatchers.not; |
| 10 | + | import static org.junit.Assert.assertThat; |
| 11 | + | |
| 12 | + | public class TestTmp2 extends InternalJadxTest { |
| 13 | + | |
| 14 | + | public static class TestCls extends Exception { |
| 15 | + | int c; |
| 16 | + | String d; |
| 17 | + | String f; |
| 18 | + | |
| 19 | + | public void testComplexIf(String a, int b) { |
| 20 | + | if (d == null || (c == 0 && b != -1 && d.length() == 0)) { |
| 21 | + | c = a.codePointAt(c); |
| 22 | + | } else { |
| 23 | + | if (a.hashCode() != 0xCDE) { |
| 24 | + | c = f.compareTo(a); |
| 25 | + | } |
| 26 | + | } |
| 27 | + | } |
| 28 | + | } |
| 29 | + | |
| 30 | + | @Test |
| 31 | + | public void test() { |
| 32 | + | ClassNode cls = getClassNode(TestCls.class); |
| 33 | + | String code = cls.getCode().toString(); |
| 34 | + | System.out.println(code); |
| 35 | + | |
| 36 | + | assertThat(code, containsString("return;")); |
| 37 | + | assertThat(code, not(containsString("else"))); |
| 38 | + | } |
| 39 | + | } |
| 40 | + | |