Package jadx.tests.integration.loops

Source Code of jadx.tests.integration.loops.TestArrayForEach2$TestCls

package jadx.tests.integration.loops;

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

import org.junit.Test;

import static jadx.tests.api.utils.JadxMatchers.containsLines;
import static org.junit.Assert.assertThat;

public class TestArrayForEach2 extends IntegrationTest {

  public static class TestCls {
    private void test(String str) {
      for (String s : str.split("\n")) {
        String t = s.trim();
        if (t.length() > 0) {
          System.out.println(t);
        }
      }
    }
  }

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

    assertThat(code, containsLines(2,
        "for (String s : str.split(\"\\n\")) {",
        indent(1) + "String t = s.trim();",
        indent(1) + "if (t.length() > 0) {",
        indent(2) + "System.out.println(t);",
        indent(1) + "}",
        "}"
    ));
  }
}
TOP

Related Classes of jadx.tests.integration.loops.TestArrayForEach2$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.