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.orthogonal;
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 OrthogonalTest extends TestCase implements Loggable {
16: private String m_logString = "";
17:
18: private int m_setFieldAroundAdviced = 0;
19:
20: private int m_getFieldAroundAdviced = 0;
21:
22: public OrthogonalTest() {
23: }
24:
25: public OrthogonalTest(String name) {
26: super (name);
27: }
28:
29: public void testMethodAdvice() {
30: m_logString = "";
31: methodAdvicedMethod();
32: assertEquals("before invocation after ", m_logString);
33: }
34:
35: public void testSetField() {
36: m_logString = "";
37: setField();
38: assertEquals("before after ", m_logString);
39: }
40:
41: public void testGetField() {
42: m_logString = "";
43: getField();
44: assertEquals("before after ", m_logString);
45: }
46:
47: // call
48: // ctor
49: public static void main(String[] args) {
50: junit.textui.TestRunner.run(suite());
51: }
52:
53: public static junit.framework.Test suite() {
54: return new junit.framework.TestSuite(OrthogonalTest.class);
55: }
56:
57: // ==== methods to test ====
58: public void log(final String wasHere) {
59: m_logString += wasHere;
60: }
61:
62: public void methodAdvicedMethod() {
63: log("invocation ");
64: }
65:
66: public void getField() {
67: int local = m_getFieldAroundAdviced;
68: }
69:
70: public void setField() {
71: int local = 1;
72: m_setFieldAroundAdviced = 1;
73: }
74: }
|