commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r919872 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
Date Sat, 06 Mar 2010 22:54:34 GMT
Author: ggregory
Date: Sat Mar  6 22:54:34 2010
New Revision: 919872

URL: http://svn.apache.org/viewvc?rev=919872&view=rev
Log:
More tests for length()

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

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java?rev=919872&r1=919871&r2=919872&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
Sat Mar  6 22:54:34 2010
@@ -23,10 +23,10 @@
 import java.util.Iterator;
 import java.util.Locale;
 
-import org.apache.commons.lang3.text.WordUtils;
-
 import junit.framework.TestCase;
 
+import org.apache.commons.lang3.text.WordUtils;
+
 /**
  * Unit tests {@link org.apache.commons.lang3.StringUtils}.
  *
@@ -1296,7 +1296,7 @@
         assertEquals("  abc", StringUtils.leftPad("abc", 5, ""));
     }
 
-    public void testLength() {
+    public void testLengthString() {
         assertEquals(0, StringUtils.length(null));
         assertEquals(0, StringUtils.length(""));
         assertEquals(0, StringUtils.length(StringUtils.EMPTY));
@@ -1304,6 +1304,22 @@
         assertEquals(1, StringUtils.length(" "));
         assertEquals(8, StringUtils.length("ABCDEFGH"));
     }
+
+    public void testLengthStringBuffer() {
+        assertEquals(0, StringUtils.length(new StringBuffer("")));
+        assertEquals(0, StringUtils.length(new StringBuffer(StringUtils.EMPTY)));
+        assertEquals(1, StringUtils.length(new StringBuffer("A")));
+        assertEquals(1, StringUtils.length(new StringBuffer(" ")));
+        assertEquals(8, StringUtils.length(new StringBuffer("ABCDEFGH")));
+    }
+
+    public void testLengthStringBuilder() {
+        assertEquals(0, StringUtils.length(new StringBuilder("")));
+        assertEquals(0, StringUtils.length(new StringBuilder(StringUtils.EMPTY)));
+        assertEquals(1, StringUtils.length(new StringBuilder("A")));
+        assertEquals(1, StringUtils.length(new StringBuilder(" ")));
+        assertEquals(8, StringUtils.length(new StringBuilder("ABCDEFGH")));
+    }
     
     //-----------------------------------------------------------------------
     public void testCenter_StringInt() {



Mime
View raw message