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.customproceed;
08:
09: import junit.framework.TestCase;
10:
11: /**
12: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
13: */
14: public class CustomProceedTest extends TestCase {
15: private static String LOG = "";
16:
17: public static void log(String msg) {
18: LOG += msg;
19: }
20:
21: public void testIntArg() {
22: LOG = "";
23: setInt(-1);
24: assertEquals("around1 -1 1 ", LOG);
25: }
26:
27: public void testLongArg() {
28: LOG = "";
29: setLong(-2);
30: assertEquals("around2 -2 2 ", LOG);
31: }
32:
33: public void testStringArg() {
34: LOG = "";
35: setString("testing");
36: assertEquals("around3 testing gnitset ", LOG);
37: }
38:
39: public void testMiscArgs1() {
40: LOG = "";
41: setMisc1(-12345, "testing");
42: assertEquals("around4 -12345 testing 12345 gnitset ", LOG);
43: }
44:
45: public void testMiscArgs2() {
46: LOG = "";
47: int[][] arr = new int[1][1];
48: arr[0][0] = -123;
49: setMisc2(-12345, "testing", arr);
50: assertEquals("around5 -12345 testing -123 12345 gnitset 123 ",
51: LOG);
52: }
53:
54: public static void main(String[] args) {
55: junit.textui.TestRunner.run(suite());
56: }
57:
58: public static junit.framework.Test suite() {
59: return new junit.framework.TestSuite(CustomProceedTest.class);
60: }
61:
62: public void setInt(int i) {
63: log(new Integer(i).toString());
64: log(" ");
65: }
66:
67: public void setLong(long l) {
68: log(new Long(l).toString());
69: log(" ");
70: }
71:
72: public void setString(String s) {
73: log(s);
74: log(" ");
75: }
76:
77: public void setMisc1(long i, String s) {
78: log(new Long(i).toString());
79: log(" ");
80: log(s);
81: log(" ");
82: }
83:
84: public void setMisc2(long i, String s, int[][] matrix) {
85: log(new Long(i).toString());
86: log(" ");
87: log(s);
88: log(" ");
89: log(new Integer(matrix[0][0]).toString());
90: log(" ");
91: }
92: }
|