test: add case for #504

This commit is contained in:
Ahmed Ashour
2019-03-24 08:47:52 +01:00
committed by skylot
parent 11cee083ba
commit 2399bfb784
@@ -0,0 +1,44 @@
package jadx.tests.integration.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
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.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class AnnotationsRenaming extends IntegrationTest {
public static class TestCls {
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public static @interface A {
int x();
}
@A(x = 5)
void test() {
}
}
@Test
@NotYetImplemented
public void test504() {
enableDeobfuscation();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsString("public static @interface "));
assertThat(code, not(containsString("(x = 5)")));
}
}