commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1243121 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
Date Sat, 11 Feb 2012 18:57:19 GMT
Author: mbenson
Date: Sat Feb 11 18:57:19 2012
New Revision: 1243121

URL: http://svn.apache.org/viewvc?rev=1243121&view=rev
Log:
test same prefix/suffix

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java?rev=1243121&r1=1243120&r2=1243121&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
Sat Feb 11 18:57:19 2012
@@ -159,14 +159,14 @@ public class StrSubstitutorTest extends 
     /**
      * Tests when no prefix or suffix.
      */
-    public void testReplaceNoPefixNoSuffix() {
+    public void testReplaceNoPrefixNoSuffix() {
         doTestReplace("The animal jumps over the lazy dog.", "The animal jumps over the ${target}.",
true);
     }
 
     /**
      * Tests when no incomplete prefix.
      */
-    public void testReplaceIncompletePefix() {
+    public void testReplaceIncompletePrefix() {
         doTestReplace("The {animal} jumps over the lazy dog.", "The {animal} jumps over the
${target}.", true);
     }
 
@@ -466,14 +466,23 @@ public class StrSubstitutorTest extends 
     /**
      * Test the replace of a properties object
      */
-    public void testSubstitutetDefaultProperties(){
+    public void testSubstituteDefaultProperties(){
         String org = "${doesnotwork}";
-        System.setProperty("doesnotwork", "It work's!");
+        System.setProperty("doesnotwork", "It works!");
 
         // create a new Properties object with the System.getProperties as default
         Properties props = new Properties(System.getProperties());
 
-        assertEquals("It work's!",StrSubstitutor.replace(org, props));
+        assertEquals("It works!", StrSubstitutor.replace(org, props));
+    }
+    
+    public void testSamePrefixAndSuffix() {
+        Map<String, String> map = new HashMap<String, String>();
+        map.put("greeting", "Hello");
+        map.put(" there ", "XXX");
+        map.put("name", "commons");
+        assertEquals("Hi commons!", StrSubstitutor.replace("Hi @name@!", map, "@", "@"));
+        assertEquals("Hello there commons!", StrSubstitutor.replace("@greeting@ there @name@!",
map, "@", "@"));
     }
 
     //-----------------------------------------------------------------------



Mime
View raw message