KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > hierarchicalpattern > HierachicalPatternTest


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.hierarchicalpattern;
9
10 import junit.framework.TestCase;
11 import test.Loggable;
12
13 /**
14  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
15  */

16 public class HierachicalPatternTest extends TestCase implements Loggable, DummyInterface1 {
17     private String JavaDoc m_logString = "";
18
19     public HierachicalPatternTest() {
20     }
21
22     public HierachicalPatternTest(String JavaDoc name) {
23         super(name);
24     }
25
26     public void testDeclaringType1() {
27         m_logString = "";
28         declaringType1();
29         assertEquals("before1 invocation after1 ", m_logString);
30     }
31
32     public void testDeclaringType2() {
33         m_logString = "";
34         declaringType2();
35         assertEquals("before1 invocation after1 ", m_logString);
36     }
37
38     public void testReturnType1() {
39         m_logString = "";
40         returnType1();
41         assertEquals("before1 invocation after1 ", m_logString);
42     }
43
44     public void testReturnType2() {
45         m_logString = "";
46         returnType2();
47         assertEquals("before1 invocation after1 ", m_logString);
48     }
49
50     public void testParameterTypes() {
51         m_logString = "";
52         parameterTypes(null, null);
53         assertEquals("before1 invocation after1 ", m_logString);
54     }
55
56     public static void main(String JavaDoc[] args) {
57         junit.textui.TestRunner.run(suite());
58     }
59
60     public static junit.framework.Test suite() {
61         return new junit.framework.TestSuite(HierachicalPatternTest.class);
62     }
63
64     // ==== methods to test ====
65
public void log(final String JavaDoc wasHere) {
66         m_logString += wasHere;
67     }
68
69     public void declaringType1() {
70         log("invocation ");
71     }
72
73     public void declaringType2() {
74         log("invocation ");
75     }
76
77     public HierachicalPatternTest returnType1() {
78         log("invocation ");
79         return null;
80     }
81
82     public DummyInterface1 returnType2() {
83         log("invocation ");
84         return null;
85     }
86
87     public void parameterTypes(HierachicalPatternTest d1, HierachicalPatternTest d2) {
88         log("invocation ");
89     }
90 }
Popular Tags