use of org.jf.smalidea.psi.impl.SmaliAnnotation in project smali by JesusFreke.
the class SmaliClassModifierListTest method testFindAnnotation.
public void testFindAnnotation() {
final SmaliFile file = (SmaliFile) myFixture.addFileToProject("my/pkg/blah.smali", ".class public final Lmy/pkg/blah;\n" + ".annotation Lanno; .end annotation\n" + ".super Ljava/lang/Object;\n" + ".annotation Lmy/pkg/anno; .end annotation\n" + ".annotation Lmy/pkg/anno2; .end annotation\n" + ".annotation Lmy/pkg/anno3; .end annotation\n");
SmaliClass smaliClass = file.getPsiClass();
SmaliModifierList modifierList = smaliClass.getModifierList();
SmaliAnnotation smaliAnnotation = modifierList.findAnnotation("my.pkg.anno2");
Assert.assertNotNull(smaliAnnotation);
Assert.assertEquals("my.pkg.anno2", smaliAnnotation.getQualifiedName());
}
use of org.jf.smalidea.psi.impl.SmaliAnnotation in project smali by JesusFreke.
the class SmaliClassModifierListTest method testBasicAnnotation.
public void testBasicAnnotation() {
final SmaliFile file = (SmaliFile) myFixture.addFileToProject("my/pkg/blah.smali", ".class public final Lmy/pkg/blah;\n" + ".super Ljava/lang/Object;\n" + ".annotation Lmy/pkg/anno; .end annotation");
SmaliClass smaliClass = file.getPsiClass();
SmaliModifierList modifierList = smaliClass.getModifierList();
SmaliAnnotation[] annotations = modifierList.getAnnotations();
Assert.assertEquals(1, annotations.length);
Assert.assertEquals("my.pkg.anno", annotations[0].getQualifiedName());
SmaliAnnotation[] applicableAnnotations = modifierList.getApplicableAnnotations();
Assert.assertEquals(1, applicableAnnotations.length);
Assert.assertEquals(annotations[0], applicableAnnotations[0]);
}
Aggregations