1 24 25 package org.objectweb.cjdbc.scenario.standalone.util; 26 27 import org.objectweb.cjdbc.common.util.Strings; 28 import org.objectweb.cjdbc.scenario.templates.NoTemplate; 29 30 36 public class StringsTest extends NoTemplate 37 { 38 39 42 public void testReplace() 43 { 44 String origString = "test string with no meaning, no meaning at all"; 45 String replaced = Strings.replace(origString, "no", "important"); 46 assertEquals("simple test", 47 "test string with important meaning, important meaning at all", 48 replaced); 49 50 origString = "test empty string"; 52 replaced = Strings.replace(origString, "", "do not replace"); 53 assertEquals("empty string test", origString, replaced); 54 55 origString = "test null string"; 57 replaced = Strings.replace(origString, null, "do not replace"); 58 assertEquals("null test", origString, replaced); 59 60 origString = "update test set datestamp = now()"; 62 replaced = Strings.replace(origString, "now()", "'2004-04-14'"); 63 assertEquals("date field test", "update test set datestamp = '2004-04-14'", 64 replaced); 65 } 66 67 } | Popular Tags |