KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > StringsTest


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

16 public class StringsTest extends TestCase {
17     public StringsTest(String JavaDoc name) {
18         super(name);
19     }
20
21     public void test1() throws Exception JavaDoc {
22         assertEquals("__BCDE", Strings.replaceSubString("ABCDE", "A", "__"));
23     }
24
25     public void test2() throws Exception JavaDoc {
26         assertEquals("A__CDE", Strings.replaceSubString("A__CDE", "B", "__"));
27     }
28
29     public void test3() throws Exception JavaDoc {
30         assertEquals("A..*B..*C..*D", Strings.replaceSubString("A..B..C..D", "..", "..*"));
31     }
32
33     public void test4() throws Exception JavaDoc {
34         assertEquals("A.*B.*C.*D", Strings.replaceSubString("A.B.C.D", ".", ".*"));
35     }
36
37     public static void main(String JavaDoc[] args) {
38         junit.textui.TestRunner.run(suite());
39     }
40
41     public static junit.framework.Test suite() {
42         return new junit.framework.TestSuite(StringsTest.class);
43     }
44 }
Popular Tags