1 8 package test; 9 10 import junit.framework.TestCase; 11 import org.codehaus.aspectwerkz.util.Strings; 12 13 16 public class StringsTest extends TestCase { 17 public StringsTest(String name) { 18 super(name); 19 } 20 21 public void test1() throws Exception { 22 assertEquals("__BCDE", Strings.replaceSubString("ABCDE", "A", "__")); 23 } 24 25 public void test2() throws Exception { 26 assertEquals("A__CDE", Strings.replaceSubString("A__CDE", "B", "__")); 27 } 28 29 public void test3() throws Exception { 30 assertEquals("A..*B..*C..*D", Strings.replaceSubString("A..B..C..D", "..", "..*")); 31 } 32 33 public void test4() throws Exception { 34 assertEquals("A.*B.*C.*D", Strings.replaceSubString("A.B.C.D", ".", ".*")); 35 } 36 37 public static void main(String [] 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 |