1 4 package test.net.sourceforge.pmd.util; 5 6 import junit.framework.TestCase; 7 import net.sourceforge.pmd.util.StringUtil; 8 9 public class StringUtilTest extends TestCase { 10 11 public void testReplaceWithOneChar() { 12 assertEquals("faa", StringUtil.replaceString("foo", 'o', "a")); 13 } 14 15 public void testReplaceWithMultipleChars() { 16 assertEquals("faaaa", StringUtil.replaceString("foo", 'o', "aa")); 17 } 18 19 public void testReplaceStringWithString() { 20 assertEquals("foo]]>bar", StringUtil.replaceString("foo]]>bar", "]]>", "]]>")); 21 } 22 23 public void testReplaceStringWithString2() { 24 assertEquals("replaceString didn't work with a >", "foobar", StringUtil.replaceString("foobar", "]]>", "]]>")); 25 } 26 27 public void testReplaceWithNull() { 28 assertEquals("replaceString didn't work with a char", "f", StringUtil.replaceString("foo", 'o', null)); 29 } 30 31 49 } 50 | Popular Tags |