1 19 20 package com.izforge.izpack.util; 21 22 import junit.framework.TestCase; 23 24 public class StringToolTest extends TestCase 25 { 26 27 30 public void testReplace() 31 { 32 String ref = "ABC-012-def"; 33 34 TestCase.assertEquals(null, StringTool.replace(null, null, null)); 35 TestCase.assertEquals("ABC-012-def", StringTool.replace(ref, null, null)); 36 TestCase.assertEquals("ABC-012-def", StringTool.replace(ref, "something", null)); 37 TestCase.assertEquals("ABC012def", StringTool.replace(ref, "-", null)); 38 TestCase.assertEquals("abc-012-def", StringTool.replace(ref, "ABC", "abc")); 39 TestCase.assertEquals("ABC-012-def", StringTool.replace(ref, "abc", "abc", false)); 40 TestCase.assertEquals("ABC-012-def", StringTool.replace(ref, "abc", "abc", true)); 41 } 42 43 46 public void testNormalizePath() 47 { 48 TestCase.assertEquals("C:\\Foo\\Bar\\is\\so\\boring;plop;plop", StringTool.normalizePath( 49 "C:\\Foo/Bar/is\\so\\boring:plop;plop", "\\")); 50 TestCase.assertEquals("/some/where/that:matters:really", StringTool.normalizePath( 51 "/some/where\\that:matters;really", "/")); 52 } 53 54 } 55 | Popular Tags |