1 19 20 package regression; 21 22 import java.io.InputStream ; 23 import java.util.List ; 24 import junit.framework.TestCase; 25 import junit.framework.*; 26 import org.netbeans.modules.classfile.*; 27 28 32 public class Issue91098Test extends TestCase { 33 34 public Issue91098Test(String testName) { 35 super(testName); 36 } 37 38 public void testAttributeLoading() throws Exception { 39 InputStream classData = 40 getClass().getResourceAsStream("datafiles/test91098.class"); 41 ClassFile classFile = new ClassFile(classData); 42 classFile.toString(); 43 } 44 45 public void testHasDeprecatedAttribute() throws Exception { 46 InputStream classData = 47 getClass().getResourceAsStream("datafiles/test91098.class"); 48 ClassFile classFile = new ClassFile(classData); 49 Method meth = classFile.getMethod("<init>", "(Ljava/lang/String;II)V"); 50 List <Parameter> params = meth.getParameters(); 51 assertEquals(params.size(), 3); Parameter param = params.get(0); 53 Annotation[] annotations = param.getAnnotations().toArray(new Annotation[0]); 54 assertEquals(annotations.length, 1); 55 ClassName type = annotations[0].getType(); 56 assertEquals(type.getExternalName(), "java.lang.Deprecated"); 57 } 58 } 59 | Popular Tags |