What am I missing? This doesn't make any sense:
Why is TextUtils.isEmpty(null)
returning false
?
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 are Using Kotlin, You can replace
TextUtils.isEmpty()
with
isNullOrEmpty
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-null-or-empty.html