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;
08:
09: import junit.framework.TestCase;
10: import org.codehaus.aspectwerkz.util.Strings;
11:
12: /**
13: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14: */
15: public class StringsTest extends TestCase {
16: public StringsTest(String name) {
17: super (name);
18: }
19:
20: public void test1() throws Exception {
21: assertEquals("__BCDE", Strings.replaceSubString("ABCDE", "A",
22: "__"));
23: }
24:
25: public void test2() throws Exception {
26: assertEquals("A__CDE", Strings.replaceSubString("A__CDE", "B",
27: "__"));
28: }
29:
30: public void test3() throws Exception {
31: assertEquals("A..*B..*C..*D", Strings.replaceSubString(
32: "A..B..C..D", "..", "..*"));
33: }
34:
35: public void test4() throws Exception {
36: assertEquals("A.*B.*C.*D", Strings.replaceSubString("A.B.C.D",
37: ".", ".*"));
38: }
39:
40: public static void main(String[] args) {
41: junit.textui.TestRunner.run(suite());
42: }
43:
44: public static junit.framework.Test suite() {
45: return new junit.framework.TestSuite(StringsTest.class);
46: }
47: }
|