1
2
3
4
5
6
7
8
9
10 package org.mule.util.scan.annotations;
11
12 import junit.framework.TestCase;
13 import org.objectweb.asm.ClassReader;
14
15 public class ClasspathAnnotationsScannerTestCase extends TestCase
16 {
17 public void testScanAnnotationsWithFilter() throws Exception
18 {
19 ClassReader r = new ClosableClassReader(SampleClassWithAnnotations.class.getName());
20 AnnotationsScanner scanner = new AnnotationsScanner(new AnnotationTypeFilter(MultiMarker.class));
21
22 r.accept(scanner, 0);
23
24 assertEquals(1, scanner.getAllAnnotations().size());
25 }
26
27 public void testScanMetaAnnotations() throws Exception
28 {
29 ClassReader r = new ClosableClassReader(SampleBeanWithAnnotations.class.getName());
30 AnnotationsScanner scanner = new AnnotationsScanner(new MetaAnnotationTypeFilter(Meta.class));
31
32 r.accept(scanner, 0);
33
34 assertEquals(2, scanner.getMethodAnnotations().size());
35 }
36 }