1 21 22 package net.sourceforge.cobertura.util; 23 24 import junit.framework.TestCase; 25 26 29 public class StringUtilTest extends TestCase 30 { 31 32 public void testReplace() 33 { 34 String result; 35 result = StringUtil.replaceAll( 36 "cobertura is a very, very cool coverage tool", "very", 37 "really"); 38 assertEquals("cobertura is a really, really cool coverage tool", 39 result); 40 41 result = StringUtil.replaceAll("<init>V", "<", "<"); 42 result = StringUtil.replaceAll(result, ">", ">"); 43 assertEquals(result, "<init>V"); 44 45 result = StringUtil.replaceAll("<init>V", "<", "<"); 46 result = StringUtil.replaceAll(result, ">", ">"); 47 assertEquals(result, "<init>V"); 48 49 assertEquals(null, StringUtil.replaceAll(null, "something", "anything")); 50 } 51 52 public static void main(String [] args) 53 { 54 new StringUtilTest().testReplace(); 55 } 56 } | Popular Tags |