Code example for Annotation

Methods: annotationType

0
 
    public void test_annotationType() { 
        Annotation [] annotations = AnnotatedClass.class.getDeclaredAnnotations();
        assertEquals(1, annotations.length);
        Annotation anno = annotations[0];
        assertEquals(TestAnnotation1.class, anno.annotationType());
    } 
 
    public void test_equals() throws Exception { 
        // test type 
        Method m1 = AnnotatedClass2.class
                .getDeclaredMethod("a", new Class[] {});
        Method m2 = AnnotatedClass2.class
                .getDeclaredMethod("b", new Class[] {});
        assertFalse("other annotation class type",
                m1.getDeclaredAnnotations()[0].equals(m2
                        .getDeclaredAnnotations()[0]));
 
        // test equality / non equality for base types and compound types 
        List<Method> methods = Arrays.asList(AnnotatedClass.class.getDeclaredMethods());
        Map<String, List<Method>> eqs = new HashMap<String, List<Method>>();