KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > customproceed > CustomProceedTest


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

15 public class CustomProceedTest extends TestCase {
16     private static String JavaDoc LOG = "";
17
18     public static void log(String JavaDoc msg) {
19         LOG += msg;
20     }
21
22     public void testIntArg() {
23         LOG = "";
24         setInt(-1);
25         assertEquals("around1 -1 1 ", LOG);
26     }
27
28     public void testLongArg() {
29         LOG = "";
30         setLong(-2);
31         assertEquals("around2 -2 2 ", LOG);
32     }
33
34     public void testStringArg() {
35         LOG = "";
36         setString("testing");
37         assertEquals("around3 testing gnitset ", LOG);
38     }
39
40     public void testMiscArgs1() {
41         LOG = "";
42         setMisc1(-12345, "testing");
43         assertEquals("around4 -12345 testing 12345 gnitset ", LOG);
44     }
45
46     public void testMiscArgs2() {
47         LOG = "";
48         int[][] arr = new int[1][1];
49         arr[0][0] = -123;
50         setMisc2(-12345, "testing", arr);
51         assertEquals("around5 -12345 testing -123 12345 gnitset 123 ", LOG);
52     }
53
54     public static void main(String JavaDoc[] 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 JavaDoc(i).toString());
64         log(" ");
65     }
66
67     public void setLong(long l) {
68         log(new Long JavaDoc(l).toString());
69         log(" ");
70     }
71
72     public void setString(String JavaDoc s) {
73         log(s);
74         log(" ");
75     }
76
77     public void setMisc1(long i, String JavaDoc s) {
78         log(new Long JavaDoc(i).toString());
79         log(" ");
80         log(s);
81         log(" ");
82     }
83
84     public void setMisc2(long i, String JavaDoc s, int[][] matrix) {
85         log(new Long JavaDoc(i).toString());
86         log(" ");
87         log(s);
88         log(" ");
89         log(new Integer JavaDoc(matrix[0][0]).toString());
90         log(" ");
91     }
92 }
93
Popular Tags