commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [1/4] [text] TEXT-88: Fixed issue with empty delimiters array with capitalizeFully
Date Thu, 06 Jul 2017 19:21:05 GMT
Repository: commons-text
Updated Branches:
  refs/heads/master 5e479dcd7 -> 9e48de8c8


TEXT-88: Fixed issue with empty delimiters array with capitalizeFully


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/3f5dfd4b
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/3f5dfd4b
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/3f5dfd4b

Branch: refs/heads/master
Commit: 3f5dfd4b1cc24fa31446a9ea5821cf267375e552
Parents: c71a5cd
Author: Amey Jadiye <ameyjadiye@gmail.com>
Authored: Mon Jun 12 23:26:46 2017 +0530
Committer: Amey Jadiye <ameyjadiye@gmail.com>
Committed: Mon Jul 3 01:08:51 2017 +0530

----------------------------------------------------------------------
 src/main/java/org/apache/commons/text/WordUtils.java     |  9 +++------
 src/test/java/org/apache/commons/text/WordUtilsTest.java | 10 ++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/3f5dfd4b/src/main/java/org/apache/commons/text/WordUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/WordUtils.java b/src/main/java/org/apache/commons/text/WordUtils.java
index 7d90730..0ffff07 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -411,8 +411,7 @@ public class WordUtils {
      * @see #capitalizeFully(String)
      */
     public static String capitalize(final String str, final char... delimiters) {
-        final int delimLen = delimiters == null ? -1 : delimiters.length;
-        if (StringUtils.isEmpty(str) || delimLen == 0) {
+        if (StringUtils.isEmpty(str)) {
             return str;
         }
         int strLen = str.length();
@@ -490,8 +489,7 @@ public class WordUtils {
      * @return capitalized String, <code>null</code> if null String input
      */
     public static String capitalizeFully(String str, final char... delimiters) {
-        final int delimLen = delimiters == null ? -1 : delimiters.length;
-        if (StringUtils.isEmpty(str) || delimLen == 0) {
+        if (StringUtils.isEmpty(str)) {
             return str;
         }
         str = str.toLowerCase();
@@ -545,8 +543,7 @@ public class WordUtils {
      * @see #capitalize(String)
      */
     public static String uncapitalize(final String str, final char... delimiters) {
-        final int delimLen = delimiters == null ? -1 : delimiters.length;
-        if (StringUtils.isEmpty(str) || delimLen == 0) {
+        if (StringUtils.isEmpty(str)) {
             return str;
         }
         int strLen = str.length();

http://git-wip-us.apache.org/repos/asf/commons-text/blob/3f5dfd4b/src/test/java/org/apache/commons/text/WordUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/WordUtilsTest.java b/src/test/java/org/apache/commons/text/WordUtilsTest.java
index 425d6d4..6904790 100644
--- a/src/test/java/org/apache/commons/text/WordUtilsTest.java
+++ b/src/test/java/org/apache/commons/text/WordUtilsTest.java
@@ -229,6 +229,16 @@ public class WordUtilsTest {
     }
 
     @Test
+    public void testCapitalizeFully_Text88() {
+        assertEquals("I am fine now",WordUtils.capitalizeFully("i am fine now", new char[]{}));
+    }
+
+    @Test
+    public void testUnCapitalize_Text88() {
+        assertEquals("i am fine now",WordUtils.uncapitalize("I am fine now", new char[]{}));
+    }
+
+    @Test
     public void testCapitalizeFullyWithDelimiters_String() {
         assertEquals(null, WordUtils.capitalizeFully(null, null));
         assertEquals("", WordUtils.capitalizeFully("", new char[0]));


Mime
View raw message