KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > rtti > RttiTest


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 JavaDoc("");
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(
24                 "+Target-1.1 Target-1.1 +Target-2.2 Target-2.2 -Target-2.2 -Target-1.1 ", RttiTarget.LOG.toString()
25         );
26
27         RttiTarget.LOG = new StringBuffer JavaDoc();
28         rttiTarget = new RttiTarget();
29         rttiTarget.doSomething(3);
30         assertEquals("+Target-3.3 Target-3.3 -Target-3.3 ", RttiTarget.LOG.toString());
31     }
32
33
34     public static void main(String JavaDoc[] args) {
35         junit.textui.TestRunner.run(suite());
36     }
37
38     public static junit.framework.Test suite() {
39         return new junit.framework.TestSuite(RttiTest.class);
40     }
41
42
43 }
44
Popular Tags