Package jadx.tests.integration

Source Code of jadx.tests.integration.TestStaticFieldsInit$TestCls

package jadx.tests.integration;

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

import org.junit.Test;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;

public class TestStaticFieldsInit extends IntegrationTest {

  public static class TestCls {
    public static final String s1 = "1";
    public static final String s2 = "12".substring(1);
    public static final String s3 = null;
    public static final String s4;
    public static final String s5 = "5";
    public static String s6 = "6";

    static {
      if (s5.equals("?")) {
        s4 = "?";
      } else {
        s4 = "4";
      }
    }
  }

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

    assertThat(code, not(containsString("public static final String s2 = null;")));
    // TODO:
    // assertThat(code, containsString("public static final String s3 = null;"));
  }
}
TOP

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