1   /***
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3   */
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("foobar", StringUtil.replaceString("foobar", "]]>", "]]>"));
25      }
26  
27  }