From: khartlage Date: Sun, 6 Jun 2004 15:02:59 +0000 (+0000) Subject: 3.x RC1 compatibility X-Git-Url: http://git.phpeclipse.com 3.x RC1 compatibility --- diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java deleted file mode 100644 index 8e9670f..0000000 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* Created on Jan 19, 2004 */ -package com.quantum.util; - -import java.lang.reflect.Method; - -import junit.framework.TestCase; - -/** - * @author holmesbc - */ -public class StringUtilTest extends TestCase { - public void testSubstituteString() throws Exception { - - String sample = "This is a test of ${variable} substitution."; - String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); - - assertEquals("replaceAll", "This is a test of parameter substitution.", replaceAll); - System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); - } - - public void testSubstituteStringAtEnd() throws Exception { - - String sample = "Substitute ${variable}"; - String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); - - System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); - } - - public void testSubstituteStringAtBeginning() throws Exception { - - String sample = "${variable} substitution"; - String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); - - System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); - } - - public void testSubstituteStringMultipleTokens() throws Exception { - - String sample = "${variable}${variable}"; - String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); - - System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); - } - - public void testSubstituteStringZeroLength() throws Exception { - - String sample = "This is a test of ${variable} substitution."; - String replaceAll = replaceAll(sample, "\\$\\{variable\\}", ""); - - System.out.println(StringUtil.substituteString(sample, "${variable}", "")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "")); - } - - public void testSubstituteStringSpecialChars() throws Exception { - - String sample = "This is a test of \r substitution."; - String replaceAll = replaceAll(sample, "\r", ""); - - System.out.println(StringUtil.substituteString(sample, "\r", "")); - assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "\r", "")); - } - - private String replaceAll(String original, String regex, String newValue) throws Exception { - Method method = String.class.getMethod("replaceAll", new Class[] { String.class, String.class } ); - return (String) method.invoke(original, new Object[] { regex, newValue } ); - } -}