Package jadx.tests.integration.conditions

Source Code of jadx.tests.integration.conditions.TestConditions9$TestCls

package jadx.tests.integration.conditions;

import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;

import org.junit.Test;

import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;

public class TestConditions9 extends IntegrationTest {

  public static class TestCls {
    public void test(boolean a, int b) throws Exception {
      if (!a || (b >= 0 && b <= 11)) {
        System.out.println('1');
      } else {
        System.out.println('2');
      }
    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsOne("if (!a || (b >= 0 && b <= 11)) {"));
    assertThat(code, containsOne("System.out.println('1');"));
    assertThat(code, containsOne("} else {"));
    assertThat(code, containsOne("System.out.println('2');"));
    assertThat(code, not(containsString("return;")));
  }
}
TOP

Related Classes of jadx.tests.integration.conditions.TestConditions9$TestCls

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.