| 1 32 package net.sf.retrotranslator.runtime.java.lang; 33 34 import java.lang.annotation.Annotation ; 35 import junit.framework.TestCase; 36 37 40 public class _PackageTestCase extends TestCase { 41 42 private Package aPackage = _PackageTestCase.class.getPackage(); 43 44 public void testIsAnnotationPresent() throws Exception { 45 assertTrue(aPackage.isAnnotationPresent(MyStyle.class)); 46 assertFalse(aPackage.isAnnotationPresent(MyFormatter.class)); 47 } 48 49 public void testGetAnnotation() throws Exception { 50 assertEquals("bold", aPackage.getAnnotation(MyStyle.class).value()); 51 assertNull(aPackage.getAnnotation(MyFormatter.class)); 52 } 53 54 public void testGetAnnotations() throws Exception { 55 Annotation [] annotations = aPackage.getAnnotations(); 56 assertEquals(1, annotations.length); 57 assertEquals("bold", ((MyStyle) annotations[0]).value()); 58 } 59 60 public void testGetDeclaredAnnotations() throws Exception { 61 Annotation [] annotations = aPackage.getDeclaredAnnotations(); 62 assertEquals(1, annotations.length); 63 assertEquals("bold", ((MyStyle) annotations[0]).value()); 64 } 65 } | Popular Tags |