01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package test.hierarchicalpattern;
08:
09: import junit.framework.TestCase;
10: import test.Loggable;
11:
12: /**
13: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14: */
15: public class HierachicalPatternTest extends TestCase implements
16: Loggable, DummyInterface1 {
17: private String m_logString = "";
18:
19: public HierachicalPatternTest() {
20: }
21:
22: public HierachicalPatternTest(String 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[] args) {
57: junit.textui.TestRunner.run(suite());
58: }
59:
60: public static junit.framework.Test suite() {
61: return new junit.framework.TestSuite(
62: HierachicalPatternTest.class);
63: }
64:
65: // ==== methods to test ====
66: public void log(final String wasHere) {
67: m_logString += wasHere;
68: }
69:
70: public void declaringType1() {
71: log("invocation ");
72: }
73:
74: public void declaringType2() {
75: log("invocation ");
76: }
77:
78: public HierachicalPatternTest returnType1() {
79: log("invocation ");
80: return null;
81: }
82:
83: public DummyInterface1 returnType2() {
84: log("invocation ");
85: return null;
86: }
87:
88: public void parameterTypes(HierachicalPatternTest d1,
89: HierachicalPatternTest d2) {
90: log("invocation ");
91: }
92: }
|