commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [4/5] [lang] Remove explicit (redundant) array creations for var args parameters
Date Thu, 07 May 2015 15:56:32 GMT
Remove explicit (redundant) array creations for var args parameters


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

Branch: refs/heads/master
Commit: ec4d8a9a6b783f1d5d603d5272c94deb1e7375ef
Parents: 405bde3
Author: Benedikt Ritter <britter@apache.org>
Authored: Thu May 7 17:53:23 2015 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Thu May 7 17:53:23 2015 +0200

----------------------------------------------------------------------
 .../lang3/StringUtilsEqualsIndexOfTest.java     | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/ec4d8a9a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 5934f15..3a739c1 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@ -117,18 +117,18 @@ public class StringUtilsEqualsIndexOfTest  {
     public void testContainsAny_StringCharArray() {
         assertFalse(StringUtils.containsAny(null, (char[]) null));
         assertFalse(StringUtils.containsAny(null, new char[0]));
-        assertFalse(StringUtils.containsAny(null, new char[] { 'a', 'b' }));
+        assertFalse(StringUtils.containsAny(null, 'a', 'b'));
 
         assertFalse(StringUtils.containsAny("", (char[]) null));
         assertFalse(StringUtils.containsAny("", new char[0]));
-        assertFalse(StringUtils.containsAny("", new char[] { 'a', 'b' }));
+        assertFalse(StringUtils.containsAny("", 'a', 'b'));
 
         assertFalse(StringUtils.containsAny("zzabyycdxx", (char[]) null));
         assertFalse(StringUtils.containsAny("zzabyycdxx", new char[0]));
-        assertTrue(StringUtils.containsAny("zzabyycdxx", new char[] { 'z', 'a' }));
-        assertTrue(StringUtils.containsAny("zzabyycdxx", new char[] { 'b', 'y' }));
-        assertTrue(StringUtils.containsAny("zzabyycdxx", new char[] { 'z', 'y' }));
-        assertFalse(StringUtils.containsAny("ab", new char[] { 'z' }));
+        assertTrue(StringUtils.containsAny("zzabyycdxx", 'z', 'a'));
+        assertTrue(StringUtils.containsAny("zzabyycdxx", 'b', 'y'));
+        assertTrue(StringUtils.containsAny("zzabyycdxx", 'z', 'y'));
+        assertFalse(StringUtils.containsAny("ab", 'z'));
     }
 
     /**
@@ -225,10 +225,10 @@ public class StringUtilsEqualsIndexOfTest  {
         assertFalse(StringUtils.containsAny("", new String[] { "hello" }));
         assertFalse(StringUtils.containsAny("hello, goodbye", (String[]) null));
         assertFalse(StringUtils.containsAny("hello, goodbye", new String[0]));
-        assertTrue(StringUtils.containsAny("hello, goodbye", new String[] { "hello", "goodbye"
}));
-        assertTrue(StringUtils.containsAny("hello, goodbye", new String[] { "hello", "Goodbye"
}));
-        assertFalse(StringUtils.containsAny("hello, goodbye", new String[] { "Hello", "Goodbye"
}));
-        assertFalse(StringUtils.containsAny("hello, goodbye", new String[] { "Hello", null
}));
+        assertTrue(StringUtils.containsAny("hello, goodbye", new String[]{"hello", "goodbye"}));
+        assertTrue(StringUtils.containsAny("hello, goodbye", new String[]{"hello", "Goodbye"}));
+        assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", "Goodbye"}));
+        assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", null}));
         assertFalse(StringUtils.containsAny("hello, null", new String[] { "Hello", null }));
     }
 
@@ -649,17 +649,17 @@ public class StringUtilsEqualsIndexOfTest  {
     public void testIndexOfAny_StringCharArray() {
         assertEquals(-1, StringUtils.indexOfAny(null, (char[]) null));
         assertEquals(-1, StringUtils.indexOfAny(null, new char[0]));
-        assertEquals(-1, StringUtils.indexOfAny(null, new char[] {'a','b'}));
+        assertEquals(-1, StringUtils.indexOfAny(null, 'a','b'));
 
         assertEquals(-1, StringUtils.indexOfAny("", (char[]) null));
         assertEquals(-1, StringUtils.indexOfAny("", new char[0]));
-        assertEquals(-1, StringUtils.indexOfAny("", new char[] {'a','b'}));
+        assertEquals(-1, StringUtils.indexOfAny("", 'a','b'));
 
         assertEquals(-1, StringUtils.indexOfAny("zzabyycdxx", (char[]) null));
         assertEquals(-1, StringUtils.indexOfAny("zzabyycdxx", new char[0]));
-        assertEquals(0, StringUtils.indexOfAny("zzabyycdxx", new char[] {'z','a'}));
-        assertEquals(3, StringUtils.indexOfAny("zzabyycdxx", new char[] {'b','y'}));
-        assertEquals(-1, StringUtils.indexOfAny("ab", new char[] {'z'}));
+        assertEquals(0, StringUtils.indexOfAny("zzabyycdxx", 'z','a'));
+        assertEquals(3, StringUtils.indexOfAny("zzabyycdxx", 'b','y'));
+        assertEquals(-1, StringUtils.indexOfAny("ab", 'z'));
     }
 
     /**
@@ -722,19 +722,19 @@ public class StringUtilsEqualsIndexOfTest  {
     @Test
     public void testIndexOfAnyBut_StringCharArray() {
         assertEquals(-1, StringUtils.indexOfAnyBut(null, (char[]) null));
-        assertEquals(-1, StringUtils.indexOfAnyBut(null, new char[0]));
-        assertEquals(-1, StringUtils.indexOfAnyBut(null, new char[] {'a','b'}));
+        assertEquals(-1, StringUtils.indexOfAnyBut(null));
+        assertEquals(-1, StringUtils.indexOfAnyBut(null, 'a','b'));
 
         assertEquals(-1, StringUtils.indexOfAnyBut("", (char[]) null));
-        assertEquals(-1, StringUtils.indexOfAnyBut("", new char[0]));
-        assertEquals(-1, StringUtils.indexOfAnyBut("", new char[] {'a','b'}));
+        assertEquals(-1, StringUtils.indexOfAnyBut(""));
+        assertEquals(-1, StringUtils.indexOfAnyBut("", 'a','b'));
 
         assertEquals(-1, StringUtils.indexOfAnyBut("zzabyycdxx", (char[]) null));
-        assertEquals(-1, StringUtils.indexOfAnyBut("zzabyycdxx", new char[0]));
-        assertEquals(3, StringUtils.indexOfAnyBut("zzabyycdxx", new char[] {'z','a'}));
-        assertEquals(0, StringUtils.indexOfAnyBut("zzabyycdxx", new char[] {'b','y'}));
-        assertEquals(-1, StringUtils.indexOfAnyBut("aba", new char[] {'a', 'b'}));
-        assertEquals(0, StringUtils.indexOfAnyBut("aba", new char[] {'z'}));
+        assertEquals(-1, StringUtils.indexOfAnyBut("zzabyycdxx"));
+        assertEquals(3, StringUtils.indexOfAnyBut("zzabyycdxx", 'z','a'));
+        assertEquals(0, StringUtils.indexOfAnyBut("zzabyycdxx", 'b','y'));
+        assertEquals(-1, StringUtils.indexOfAnyBut("aba", 'a', 'b'));
+        assertEquals(0, StringUtils.indexOfAnyBut("aba", 'z'));
 
     }
 


Mime
View raw message