You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2008/07/01 06:53:51 UTC
svn commit: r672995 - in /commons/proper/lang/trunk/src:
java/org/apache/commons/lang/StringUtils.java
test/org/apache/commons/lang/StringUtilsTest.java
Author: bayard
Date: Mon Jun 30 21:53:50 2008
New Revision: 672995
URL: http://svn.apache.org/viewvc?rev=672995&view=rev
Log:
Added javadoc to show that LANG-444 can be implemented by defaultIfEmpty, and proved it in the unit test
Modified:
commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java
Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java?rev=672995&r1=672994&r2=672995&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringUtils.java Mon Jun 30 21:53:50 2008
@@ -5308,6 +5308,7 @@
* StringUtils.defaultIfEmpty(null, "NULL") = "NULL"
* StringUtils.defaultIfEmpty("", "NULL") = "NULL"
* StringUtils.defaultIfEmpty("bat", "NULL") = "bat"
+ * StringUtils.defaultIfEmpty("", null) = null
* </pre>
*
* @see StringUtils#defaultString(String, String)
Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java?rev=672995&r1=672994&r2=672995&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/StringUtilsTest.java Mon Jun 30 21:53:50 2008
@@ -1512,6 +1512,7 @@
assertEquals("NULL", StringUtils.defaultIfEmpty(null, "NULL"));
assertEquals("NULL", StringUtils.defaultIfEmpty("", "NULL"));
assertEquals("abc", StringUtils.defaultIfEmpty("abc", "NULL"));
+ assertNull(StringUtils.defaultIfEmpty("", null));
}
//-----------------------------------------------------------------------