Author: scolebourne Date: Tue Aug 8 16:28:45 2006 New Revision: 429881 URL: http://svn.apache.org/viewvc?rev=429881&view=rev Log: Create StrLookup by extraction from StrSubstitutor
Added: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java (with props) jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java (with props) Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java Added: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java?rev=429881&view=auto ============================================================================== --- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java (added) +++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java Tue Aug 8 16:28:45 2006 @@ -0,0 +1,160 @@ +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang.text; + +import java.util.Map; + +/** + * Lookup a String key to a String value. + * <p> + * This class represents the simplest form of a string to string map. + * It has a benefit over a map in that it can create the result on + * demand based on the key. + * <p> + * This class comes complete with various factory methods. + * If these do not suffice, you can subclass and implement your own matcher. + * <p> + * For example, it would be possible to implement a lookup that used the + * key as a primary key, and looked up the value on demand from the database + * + * @author Stephen Colebourne + * @since 2.2 + * @version $Id: $ + */ +public abstract class StrLookup { + + /** + * Lookup that always returns null. + */ + private static final StrLookup NONE_LOOKUP; + /** + * Lookup that uses System properties. + */ + private static final StrLookup SYSTEM_PROPERTIES_LOOKUP; + static { + NONE_LOOKUP = new MapStrLookup(null); + StrLookup lookup = null; + try { + lookup = new MapStrLookup(System.getProperties()); + } catch (SecurityException ex) { + lookup = NONE_LOOKUP; + } + SYSTEM_PROPERTIES_LOOKUP = lookup; + } + + //----------------------------------------------------------------------- + /** + * Returns a lookup which always returns null. + * + * @return a lookup that always returns null, not null + */ + public static StrLookup noneLookup() { + return NONE_LOOKUP; + } + + /** + * Returns a lookup which uses [EMAIL PROTECTED] System#getProperties() System properties} + * to lookup the key to value. + * <p> + * If a security manager blocked access to system properties, then null will + * be returned from every lookup. + * <p> + * If a null key is used, this lookup will throw a NullPointerException. + * + * @return a lookup using system properties, not null + */ + public static StrLookup systemPropertiesLookup() { + return SYSTEM_PROPERTIES_LOOKUP; + } + + /** + * Returns a lookup which looks up values using a map. + * <p> + * If the map is null, then null will be returned from every lookup. + * The map result object is converted to a string using toString(). + * + * @param map the map of keys to values, may be null + * @return a lookup using the map, not null + */ + public static StrLookup mapLookup(Map map) { + return new MapStrLookup(map); + } + + //----------------------------------------------------------------------- + /** + * Constructor. + */ + protected StrLookup() { + super(); + } + + /** + * Looks up a String key to a String value. + * <p> + * The internal implementation may use any mechanism to return the value. + * The simplest implementation is to use a Map. However, virtually any + * implementation is possible. + * <p> + * For example, it would be possible to implement a lookup that used the + * key as a primary key, and looked up the value on demand from the database + * Or, a numeric based implementation could be created that treats the key + * as an integer, increments the value and return the result as a string - + * converting 1 to 2, 15 to 16 etc. + * + * @param key the key to be looked up, may be null + * @return the matching value, null if no match + */ + public abstract String lookup(String key); + + //----------------------------------------------------------------------- + /** + * Lookup imnplementation that uses a Map. + */ + static class MapStrLookup extends StrLookup { + + /** Map keys are variable names and value. */ + private final Map map; + + /** + * Creates a new instance backed by a Map. + * + * @param map the map of keys to values, may be null + */ + MapStrLookup(Map map) { + this.map = map; + } + + /** + * Looks up a String key to a String value using the map. + * <p> + * If the map is null, then null is returned. + * The map result object is converted to a string using toString(). + * + * @param key the key to be looked up, may be null + * @return the matching value, null if no match + */ + public String lookup(String key) { + if (map == null) { + return null; + } + Object obj = map.get(key); + if (obj == null) { + return null; + } + return obj.toString(); + } + } +} Propchange: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrLookup.java ------------------------------------------------------------------------------ svn:keywords = author date id revision Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java?rev=429881&r1=429880&r2=429881&view=diff ============================================================================== --- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java (original) +++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrSubstitutor.java Tue Aug 8 16:28:45 2006 @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.commons.lang.text; import java.util.ArrayList; @@ -119,7 +118,7 @@ /** * Variable resolution is delegated to an implementor of VariableResolver. */ - private VariableResolver variableResolver; + private StrLookup variableResolver; //----------------------------------------------------------------------- /** @@ -158,7 +157,7 @@ * @return the result of the replace operation */ public static String replaceSystemProperties(Object source) { - return new StrSubstitutor(System.getProperties()).replace(source); + return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source); } //----------------------------------------------------------------------- @@ -167,7 +166,7 @@ * and the escaping character. */ public StrSubstitutor() { - this((VariableResolver) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); + this((StrLookup) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } /** @@ -177,7 +176,7 @@ * @param valueMap the map with the variables' values, may be null */ public StrSubstitutor(Map valueMap) { - this(new MapVariableResolver(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); + this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } /** @@ -189,7 +188,7 @@ * @throws IllegalArgumentException if the prefix or suffix is null */ public StrSubstitutor(Map valueMap, String prefix, String suffix) { - this(valueMap, prefix, suffix, DEFAULT_ESCAPE); + this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); } /** @@ -202,7 +201,16 @@ * @throws IllegalArgumentException if the prefix or suffix is null */ public StrSubstitutor(Map valueMap, String prefix, String suffix, char escape) { - this(new MapVariableResolver(valueMap), prefix, suffix, escape); + this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); + } + + /** + * Creates a new instance and initializes it. + * + * @param variableResolver the variable resolver, may be null + */ + public StrSubstitutor(StrLookup variableResolver) { + this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } /** @@ -214,7 +222,7 @@ * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ - public StrSubstitutor(VariableResolver variableResolver, String prefix, String suffix, char escape) { + public StrSubstitutor(StrLookup variableResolver, String prefix, String suffix, char escape) { this.setVariableResolver(variableResolver); this.setVariablePrefix(prefix); this.setVariableSuffix(suffix); @@ -225,15 +233,16 @@ * Creates a new instance and initializes it. * * @param variableResolver the variable resolver, may be null - * @param prefix the prefix for variables, not null - * @param suffix the suffix for variables, not null + * @param prefixMatcher the prefix for variables, not null + * @param suffixMatcher the suffix for variables, not null * @param escape the escape character * @throws IllegalArgumentException if the prefix or suffix is null */ - public StrSubstitutor(VariableResolver variableResolver, StrMatcher prefix, StrMatcher suffix, char escape) { + public StrSubstitutor( + StrLookup variableResolver, StrMatcher prefixMatcher, StrMatcher suffixMatcher, char escape) { this.setVariableResolver(variableResolver); - this.setVariablePrefixMatcher(prefix); - this.setVariableSuffixMatcher(suffix); + this.setVariablePrefixMatcher(prefixMatcher); + this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); } @@ -308,7 +317,7 @@ } StrBuilder buf = new StrBuilder(length).append(source, offset, length); if (substitute(buf, 0, length) == false) { - return source.substring(offset, length); + return source.substring(offset, offset + length); } return buf.toString(); } @@ -510,11 +519,11 @@ * @return the variable's value or <b>null</b> if the variable is unknown */ protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) { - VariableResolver lookup = getVariableResolver(); - if (lookup == null) { + StrLookup resolver = getVariableResolver(); + if (resolver == null) { return null; } - return lookup.resolveVariable(variableName); + return resolver.lookup(variableName); } // Escape @@ -672,73 +681,21 @@ // Resolver //----------------------------------------------------------------------- /** - * Gets the VariableResolver + * Gets the VariableResolver that is used to lookup variables. * * @return the VariableResolver */ - public VariableResolver getVariableResolver() { + public StrLookup getVariableResolver() { return this.variableResolver; } /** - * Sets the VariableResolver + * Sets the VariableResolver that is used to lookup variables. * * @param variableResolver the VariableResolver */ - public void setVariableResolver(VariableResolver variableResolver) { + public void setVariableResolver(StrLookup variableResolver) { this.variableResolver = variableResolver; - } - - //----------------------------------------------------------------------- - /** - * Looks up a string value by name. - * This represents the simplest form of a map. - */ - public static interface VariableResolver { - /** - * Resolves the variable name to a value. - * - * @param varName the name to be looked up, may be null - * @return the matching value, null if no match - */ - String resolveVariable(String varName); - } - - //----------------------------------------------------------------------- - /** - * Looks up a string value by name using a [EMAIL PROTECTED] Map}. - */ - static class MapVariableResolver implements VariableResolver { - /** - * Map keys are variable names and value - */ - Map map; - - /** - * Creates a new resolver backed by a Map. - * - * @param map the variable names and values - */ - MapVariableResolver(Map map) { - this.map = map; - } - - /** - * Resolves the given variable name with the backing Map. - * - * @param varName a variable name - * @return a value or null if the variable name is not in Map - */ - public String resolveVariable(String varName) { - if (map == null) { - return null; - } - Object obj = map.get(varName); - if (obj == null) { - return null; - } - return obj.toString(); - } } } Added: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java?rev=429881&view=auto ============================================================================== --- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java (added) +++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java Tue Aug 8 16:28:45 2006 @@ -0,0 +1,99 @@ +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang.text; + +import java.util.HashMap; +import java.util.Map; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * Test class for StrLookup. + * + * @version $Id: StrSubstitutorTest.java 231316 2005-08-10 20:36:26Z ggregory $ + */ +public class StrLookupTest extends TestCase { + + /** + * Main method. + * + * @param args command line arguments, ignored + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * Return a new test suite containing this test case. + * + * @return a new test suite containing this test case + */ + public static Test suite() { + TestSuite suite = new TestSuite(StrLookupTest.class); + suite.setName("StrLookup Tests"); + return suite; + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + //----------------------------------------------------------------------- + public void testNoneLookup() { + assertEquals(null, StrLookup.noneLookup().lookup(null)); + assertEquals(null, StrLookup.noneLookup().lookup("")); + assertEquals(null, StrLookup.noneLookup().lookup("any")); + } + + public void testSystemProperiesLookup() { + assertEquals(System.getProperty("os.name"), StrLookup.systemPropertiesLookup().lookup("os.name")); + assertEquals(null, StrLookup.systemPropertiesLookup().lookup("")); + assertEquals(null, StrLookup.systemPropertiesLookup().lookup("other")); + try { + StrLookup.systemPropertiesLookup().lookup(null); + fail(); + } catch (NullPointerException ex) { + // expected + } + } + + public void testMapLookup() { + Map map = new HashMap(); + map.put("key", "value"); + map.put("number", new Integer(2)); + assertEquals("value", StrLookup.mapLookup(map).lookup("key")); + assertEquals("2", StrLookup.mapLookup(map).lookup("number")); + assertEquals(null, StrLookup.mapLookup(map).lookup(null)); + assertEquals(null, StrLookup.mapLookup(map).lookup("")); + assertEquals(null, StrLookup.mapLookup(map).lookup("other")); + } + + public void testMapLookup_nullMap() { + Map map = null; + assertEquals(null, StrLookup.mapLookup(map).lookup(null)); + assertEquals(null, StrLookup.mapLookup(map).lookup("")); + assertEquals(null, StrLookup.mapLookup(map).lookup("any")); + } + +} Propchange: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrLookupTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java?rev=429881&r1=429880&r2=429881&view=diff ============================================================================== --- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java (original) +++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrSubstitutorTest.java Tue Aug 8 16:28:45 2006 @@ -67,95 +67,6 @@ } //----------------------------------------------------------------------- -// /** -// * Tests escaping variable references. -// */ -// public void testEscape() { -// assertEquals("${", this.getFormat().replace("$${")); -// assertEquals("${animal}", this.getFormat().replace("$${animal}")); -// this.getValueMap().put("var_name", "x"); -// assertEquals("Many $$$$${target} $s", this.getFormat().replace("Many $$$$$${target} $s")); -// assertEquals("Variable ${x} must be used!", this.getFormat().replace("Variable $${${var_name}} must be used!")); -// } -// -// /** -// * Tests creating new <code>VariableFormat</code> objects. -// */ -// public void testInitialize() { -// assertNotNull(this.getFormat().getVariableResolver()); -// assertEquals(StrSubstitutor.DEFAULT_PREFIX, this.getFormat().getVariablePrefixMatcher()); -// assertEquals(StrSubstitutor.DEFAULT_SUFFIX, this.getFormat().getVariableSuffixMatcher()); -// assertEquals(StrSubstitutor.DEFAULT_ESCAPE, this.getFormat().getEscapeChar()); -// -// format = new StrSubstitutor(values, "<<", ">>", '\\'); -// assertEquals("<<", this.getFormat().getVariablePrefixMatcher()); -// assertEquals(">>", this.getFormat().getVariableSuffixMatcher()); -// assertEquals('\\', this.getFormat().getEscapeChar()); -// -// // new StrSubstitutor(null) should be OK IMO -// // Gary Gregory - July 14 2005 -// // try { -// // format = new StrSubstitutor(null); -// // fail("Could create format object with null map!"); -// // } catch (IllegalArgumentException iex) { -// // // ok -// // } -// -// try { -// format = new StrSubstitutor(values, "${", null); -// fail("Could create format object with undefined suffix!"); -// } catch (IllegalArgumentException iex) { -// // ok -// } -// -// try { -// format = new StrSubstitutor(values, null, "]"); -// fail("Could create format object with undefined prefix!"); -// } catch (IllegalArgumentException iex) { -// // ok -// } -// } -// -// /** -// * Tests chaning variable prefix and suffix and the escaping character. -// */ -// public void testNonDefaultTokens() { -// format = new StrSubstitutor(values, "<<", ">>", '\\'); -// assertEquals("The quick brown fox jumps over the lazy dog.", format -// .replace("The <<animal>> jumps over the <<target>>.")); -// assertEquals("The quick brown fox jumps over the <<target>>.", format -// .replace("The <<animal>> jumps over the \\<<target>>.")); -// } -// -// /** -// * Tests invoking the static convenience methods. -// */ -// public void testNonInstanceMethods() { -// assertEquals("The quick brown fox jumps over the lazy dog.", -// StrSubstitutor.replace(REPLACE_TEMPLATE, values)); -// values.put(KEY_ANIMAL, "cow"); -// values.put(KEY_TARGET, "moon"); -// assertEquals("The cow jumps over the moon.", -// StrSubstitutor.replace("The &animal; jumps over the ⌖.", values, "&", ";")); -// } -// -// public void testNoResolver() throws Exception { -// this.testNoResolver(new StrSubstitutor()); -// this.testNoResolver(new StrSubstitutor(null)); -// } -// -// void testNoResolver(StrSubstitutor formatter) throws Exception { -// formatter.setVariableResolver(null); -// this.validateNoReplace(formatter); -// } -// -// public void testNullMap() throws Exception { -// StrSubstitutor formatter = new StrSubstitutor(null); -// validateNoReplace(formatter); -// } -// - - //----------------------------------------------------------------------- /** * Tests simple key replace. */ @@ -353,6 +264,14 @@ doTestNoReplace("${${ }}"); } + /** + * Tests simple key replace. + */ + public void testReplacePartialString_noReplace() { + StrSubstitutor sub = new StrSubstitutor(); + assertEquals("${animal} jumps", sub.replace("The ${animal} jumps over the ${target}.", 4, 15)); + } + //----------------------------------------------------------------------- /** * Tests protected. @@ -376,6 +295,108 @@ //----------------------------------------------------------------------- /** + * Tests constructor. + */ + public void testConstructorNoArgs() { + StrSubstitutor sub = new StrSubstitutor(); + assertEquals("Hi ${name}", sub.replace("Hi ${name}")); + } + + /** + * Tests constructor. + */ + public void testConstructorMapPrefixSuffix() { + Map map = new HashMap(); + map.put("name", "commons"); + StrSubstitutor sub = new StrSubstitutor(map, "<", ">"); + assertEquals("Hi < commons", sub.replace("Hi $< <name>")); + } + + /** + * Tests constructor. + */ + public void testConstructorMapFull() { + Map map = new HashMap(); + map.put("name", "commons"); + StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!'); + assertEquals("Hi < commons", sub.replace("Hi !< <name>")); + } + + //----------------------------------------------------------------------- + /** + * Tests get set. + */ + public void testGetSetEscape() { + StrSubstitutor sub = new StrSubstitutor(); + assertEquals('$', sub.getEscapeChar()); + sub.setEscapeChar('<'); + assertEquals('<', sub.getEscapeChar()); + } + + /** + * Tests get set. + */ + public void testGetSetPrefix() { + StrSubstitutor sub = new StrSubstitutor(); + assertEquals(true, sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); + sub.setVariablePrefix('<'); + assertEquals(true, sub.getVariablePrefixMatcher() instanceof StrMatcher.CharMatcher); + + sub.setVariablePrefix("<<"); + assertEquals(true, sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); + try { + sub.setVariablePrefix((String) null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + assertEquals(true, sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher); + + StrMatcher matcher = StrMatcher.commaMatcher(); + sub.setVariablePrefixMatcher(matcher); + assertSame(matcher, sub.getVariablePrefixMatcher()); + try { + sub.setVariablePrefixMatcher((StrMatcher) null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + assertSame(matcher, sub.getVariablePrefixMatcher()); + } + + /** + * Tests get set. + */ + public void testGetSetSuffix() { + StrSubstitutor sub = new StrSubstitutor(); + assertEquals(true, sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); + sub.setVariableSuffix('<'); + assertEquals(true, sub.getVariableSuffixMatcher() instanceof StrMatcher.CharMatcher); + + sub.setVariableSuffix("<<"); + assertEquals(true, sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); + try { + sub.setVariableSuffix((String) null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + assertEquals(true, sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); + + StrMatcher matcher = StrMatcher.commaMatcher(); + sub.setVariableSuffixMatcher(matcher); + assertSame(matcher, sub.getVariableSuffixMatcher()); + try { + sub.setVariableSuffixMatcher((StrMatcher) null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + assertSame(matcher, sub.getVariableSuffixMatcher()); + } + + //----------------------------------------------------------------------- + /** * Tests static. */ public void testStaticReplace() { @@ -443,9 +464,12 @@ assertEquals(replaceTemplate, sub.replace(replaceTemplate)); if (replaceTemplate == null) { + assertEquals(null, sub.replace((String) null, 0, 100)); assertEquals(null, sub.replace((char[]) null)); + assertEquals(null, sub.replace((char[]) null, 0, 100)); assertEquals(null, sub.replace((Object) null)); assertEquals(false, sub.replace((StrBuilder) null)); + assertEquals(false, sub.replace((StrBuilder) null, 0, 100)); } else { StrBuilder bld = new StrBuilder(replaceTemplate); assertEquals(false, sub.replace(bld)); Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java?rev=429881&r1=429880&r2=429881&view=diff ============================================================================== --- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java (original) +++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/TextTestSuite.java Tue Aug 8 16:28:45 2006 @@ -51,7 +51,9 @@ suite.addTest(CompositeFormatTest.suite()); suite.addTest(StrBuilderTest.suite()); suite.addTest(StrBuilderAppendInsertTest.suite()); + suite.addTest(StrLookupTest.suite()); suite.addTest(StrMatcherTest.suite()); + suite.addTest(StrSubstitutorTest.suite()); suite.addTest(StrTokenizerTest.suite()); suite.addTestSuite(VariableFormatterTest.class); return suite; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]