test: add test case for anonymous type, and move assertions to NYI (PR #589)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package jadx.tests.integration.inner;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.NotYetImplemented;
|
||||
import jadx.tests.api.IntegrationTest;
|
||||
|
||||
public class TestAnonymousClass13 extends IntegrationTest {
|
||||
|
||||
public static class TestCls {
|
||||
|
||||
public void test() {
|
||||
new TestCls() {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@NotYetImplemented
|
||||
public void test() {
|
||||
getClassNode(TestCls.class);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class TestAnonymousClass2 extends IntegrationTest {
|
||||
}
|
||||
};
|
||||
}
|
||||
/*
|
||||
|
||||
public Runnable test3() {
|
||||
final int i = f + 2;
|
||||
return new Runnable() {
|
||||
@@ -43,7 +43,6 @@ public class TestAnonymousClass2 extends IntegrationTest {
|
||||
}
|
||||
};
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ public class TestAnonymousClass2 extends IntegrationTest {
|
||||
assertThat(code, not(containsString("synthetic")));
|
||||
assertThat(code, not(containsString("AnonymousClass_")));
|
||||
assertThat(code, containsString("f = 1;"));
|
||||
// assertThat(code, containsString("f = i;"));
|
||||
assertThat(code, containsString("f = i;"));
|
||||
assertThat(code, not(containsString("Inner obj = ;")));
|
||||
assertThat(code, containsString("Inner.this;"));
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package jadx.tests.integration.inner;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.NotYetImplemented;
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.tests.api.IntegrationTest;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
||||
public class TestAnonymousClass3 extends IntegrationTest {
|
||||
|
||||
@@ -47,9 +49,17 @@ public class TestAnonymousClass3 extends IntegrationTest {
|
||||
assertThat(code, containsString(indent(4) + "public void run() {"));
|
||||
assertThat(code, containsString(indent(3) + "}.start();"));
|
||||
|
||||
// assertThat(code, not(containsString("synthetic")));
|
||||
// assertThat(code, not(containsString("AnonymousClass_")));
|
||||
assertThat(code, not(containsString("AnonymousClass_")));
|
||||
}
|
||||
|
||||
// assertThat(code, containsString("a = f--;"));
|
||||
@Test
|
||||
@NotYetImplemented
|
||||
public void test2() {
|
||||
disableCompilation();
|
||||
ClassNode cls = getClassNode(TestCls.class);
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, not(containsString("synthetic")));
|
||||
assertThat(code, containsString("a = f--;"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user