Added javadoc to show that LANG-444 can be implemented by defaultIfEmpty, and proved it in the unit test
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@672995 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db5c7106a4
commit
b353a8e999
|
@ -5308,6 +5308,7 @@ public class StringUtils {
|
|||
* StringUtils.defaultIfEmpty(null, "NULL") = "NULL"
|
||||
* StringUtils.defaultIfEmpty("", "NULL") = "NULL"
|
||||
* StringUtils.defaultIfEmpty("bat", "NULL") = "bat"
|
||||
* StringUtils.defaultIfEmpty("", null) = null
|
||||
* </pre>
|
||||
*
|
||||
* @see StringUtils#defaultString(String, String)
|
||||
|
|
|
@ -1512,6 +1512,7 @@ public class StringUtilsTest extends TestCase {
|
|||
assertEquals("NULL", StringUtils.defaultIfEmpty(null, "NULL"));
|
||||
assertEquals("NULL", StringUtils.defaultIfEmpty("", "NULL"));
|
||||
assertEquals("abc", StringUtils.defaultIfEmpty("abc", "NULL"));
|
||||
assertNull(StringUtils.defaultIfEmpty("", null));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue