1 /***************************************************************************************
2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package test.annotation;
9
10 import org.codehaus.aspectwerkz.reflect.ClassInfo;
11 import org.codehaus.aspectwerkz.reflect.MethodInfo;
12 import org.codehaus.aspectwerkz.reflect.impl.asm.AsmClassInfo;
13 import org.codehaus.aspectwerkz.annotation.Annotations;
14 import org.codehaus.aspectwerkz.annotation.AnnotationInfo;
15 import org.codehaus.aspectwerkz.annotation.instrumentation.asm.AsmAnnotations;
16 import junit.framework.TestCase;
17
18 /***
19 * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
20 */
21 public class AnnotationLoadingTest extends TestCase {
22
23 public void testAnnotationLoadingWithClassRef() throws Throwable {
24 System.out.println("START");
25 ClassInfo klass = AsmClassInfo.getClassInfo("test.annotation.AnnotationLoadingTarget", AnnotationLoadingTest.class.getClassLoader());
26 MethodInfo m = klass.getMethods()[0];
27 AnnotationInfo annInfo = (AnnotationInfo) m.getAnnotations().get(0);
28
29 System.out.println("DONE");
30 System.out.println(annInfo.getAnnotation());
31 AnnotationParserTest.Complex c = ((AnnotationParserTest.Complex)annInfo.getAnnotation());
32 System.out.println(c.klass().getName());
33 System.out.println(c.toString());
34 System.out.println(c.klass2()[0]);
35 }
36
37 public static void main(String[] args) {
38 junit.textui.TestRunner.run(suite());
39 }
40
41 public static junit.framework.Test suite() {
42 return new junit.framework.TestSuite(AnnotationLoadingTest.class);
43 }
44
45 }