What am I missing? This doesn't make any sense:
Why is TextUtils.isEmpty(null)
returning false
?
isEmpty(CharSequence str) Returns true if the string is null or 0-length. static boolean. isGraphic(CharSequence str) Returns whether the given CharSequence contains any printable characters.
Yes, TextUtils. isEmpty(string) is preferred. TextUtils will always return a boolean value. In code, the former simply calls the equivalent of the other, plus a null check.
I faced this same issue while writing my unit test. The problem was I had following setting in my Gradle:
testOptions {
unitTests.returnDefaultValues = true
}
By default android code returned default value, while running my unit tests. Just get rid of that and you should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With