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.rtti;
9   
10  import junit.framework.TestCase;
11  
12  /***
13   * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur</a>
14   */
15  public class RttiTest extends TestCase {
16  
17      public void testTarget() {
18          RttiTarget.LOG = new StringBuffer("");
19          RttiTarget rttiTarget = new RttiTarget();
20          rttiTarget.doSomething(1);
21          // will have a nested call to another instance of target, with arg0 = 2
22  
23          assertEquals("+Target-1.1 Target-1.1 +Target-2.2 Target-2.2 -Target-2.2 -Target-1.1 ", RttiTarget.LOG.toString());
24  
25          RttiTarget.LOG = new StringBuffer();
26          rttiTarget = new RttiTarget();
27          rttiTarget.doSomething(3);
28          assertEquals("+Target-3.3 Target-3.3 -Target-3.3 ", RttiTarget.LOG.toString());
29      }
30  
31  
32      public static void main(String[] args) {
33          junit.textui.TestRunner.run(suite());
34      }
35  
36      public static junit.framework.Test suite() {
37          return new junit.framework.TestSuite(RttiTest.class);
38      }
39  
40  
41  }