1 /** 2 * 3 */ 4 package net.sf.statsvn.util; 5 6 import junit.framework.TestCase; 7 8 /** 9 * @author Benoit Xhenseval 10 * 11 */ 12 public class SvnInfoUtilTest extends TestCase { 13 public void testReplace() { 14 assertEquals("String with no space", "thisisatest", StringUtils.replace(" ", "%20", "thisisatest")); 15 assertEquals("null String", null, StringUtils.replace(" ", "%20", null)); 16 assertEquals("empty String", "", StringUtils.replace(" ", "%20", "")); 17 assertEquals("null pattern", "thisisatest", StringUtils.replace(null, "%20", "thisisatest")); 18 assertEquals("empty pattern", "thisisatest", StringUtils.replace("", "%20", "thisisatest")); 19 assertEquals("1 pattern", "this%20isatest", StringUtils.replace(" ", "%20", "this isatest")); 20 assertEquals("2 patterns", "this%20is%20atest", StringUtils.replace(" ", "%20", "this is atest")); 21 assertEquals("3 patterns", "this%20is%20a%20test", StringUtils.replace(" ", "%20", "this is a test")); 22 assertEquals("4 patterns", "%20this%20is%20a%20test", StringUtils.replace(" ", "%20", " this is a test")); 23 assertEquals("5 patterns", "%20this%20is%20a%20%20test", StringUtils.replace(" ", "%20", " this is a test")); 24 assertEquals("6 patterns", "%20this%20is%20a%20%20test%20", StringUtils.replace(" ", "%20", " this is a test ")); 25 } 26 }