commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lguib...@apache.org
Subject [2/3] [lang] LANG-1185 Add some tests for StringUtils replaceAll and replaceFirst methods
Date Thu, 05 Nov 2015 13:21:56 GMT
LANG-1185 Add some tests for StringUtils replaceAll and replaceFirst methods


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/242b8154
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/242b8154
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/242b8154

Branch: refs/heads/master
Commit: 242b815437b9a988c2ce9e980295ca8a9e302e7a
Parents: b4842f5
Author: Loic Guibert <lguibert@apache.org>
Authored: Thu Nov 5 17:17:20 2015 +0400
Committer: Loic Guibert <lguibert@apache.org>
Committed: Thu Nov 5 17:17:20 2015 +0400

----------------------------------------------------------------------
 src/main/java/org/apache/commons/lang3/StringUtils.java     | 2 ++
 src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/242b8154/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index d83f28b..a76e3f2 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -4867,6 +4867,7 @@ public class StringUtils {
      * StringUtils.replaceAll("", "", "zzz")    = "zzz"
      * StringUtils.replaceAll("", ".*", "zzz")  = "zzz"
      * StringUtils.replaceAll("", ".+", "zzz")  = ""
+     * StringUtils.replaceAll("abc", "", "ZZ")  = "ZZaZZbZZcZZ"
      * StringUtils.replaceAll("<__>\n<__>", "<.*>", "z")      = "z\nz"
      * StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z")  = "z"
      * StringUtils.replaceAll("ABCabc123", "[a-z]", "_")       = "ABC___123"
@@ -4920,6 +4921,7 @@ public class StringUtils {
      * StringUtils.replaceFirst("", "", "zzz")    = "zzz"
      * StringUtils.replaceFirst("", ".*", "zzz")  = "zzz"
      * StringUtils.replaceFirst("", ".+", "zzz")  = ""
+     * StringUtils.replaceFirst("abc", "", "ZZ")  = "ZZabc"
      * StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z")      = "z\n<__>"
      * StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z")  = "z"
      * StringUtils.replaceFirst("ABCabc123", "[a-z]", "_")          = "ABC_bc123"

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/242b8154/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 2a4b415..d6fc7ae 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -1226,7 +1226,7 @@ public class StringUtilsTest {
     }
 
     @Test
-    public void testReplaceAll_StringStringString() {
+    public void testReplaceAll() {
         assertNull(StringUtils.replaceAll(null, "", ""));
 
         assertEquals("any", StringUtils.replaceAll("any", null, ""));
@@ -1235,6 +1235,7 @@ public class StringUtilsTest {
         assertEquals("zzz", StringUtils.replaceAll("", "", "zzz"));
         assertEquals("zzz", StringUtils.replaceAll("", ".*", "zzz"));
         assertEquals("", StringUtils.replaceAll("", ".+", "zzz"));
+        assertEquals("ZZaZZbZZcZZ", StringUtils.replaceAll("abc", "", "ZZ"));
 
         assertEquals("z\nz", StringUtils.replaceAll("<__>\n<__>", "<.*>",
"z"));
         assertEquals("z", StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>",
"z"));
@@ -1254,7 +1255,7 @@ public class StringUtilsTest {
     }
 
     @Test
-    public void testReplaceFirst_StringStringString() {
+    public void testReplaceFirst() {
         assertNull(StringUtils.replaceFirst(null, "", ""));
 
         assertEquals("any", StringUtils.replaceFirst("any", null, ""));
@@ -1263,6 +1264,7 @@ public class StringUtilsTest {
         assertEquals("zzz", StringUtils.replaceFirst("", "", "zzz"));
         assertEquals("zzz", StringUtils.replaceFirst("", ".*", "zzz"));
         assertEquals("", StringUtils.replaceFirst("", ".+", "zzz"));
+        assertEquals("ZZabc", StringUtils.replaceFirst("abc", "", "ZZ"));
 
         assertEquals("z\n<__>", StringUtils.replaceFirst("<__>\n<__>",
"<.*>", "z"));
         assertEquals("z", StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>",
"z"));


Mime
View raw message