Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 62355 invoked from network); 6 Mar 2010 22:55:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Mar 2010 22:55:14 -0000 Received: (qmail 59803 invoked by uid 500); 6 Mar 2010 22:54:55 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 59749 invoked by uid 500); 6 Mar 2010 22:54:55 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 59741 invoked by uid 99); 6 Mar 2010 22:54:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Mar 2010 22:54:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Mar 2010 22:54:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D05A923889E1; Sat, 6 Mar 2010 22:54:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100306225434.D05A923889E1@eris.apache.org> 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() {