I know what having the following in an Android project's build.gradle is supposed to do. But how does it work? And what exactly are the default values returned? How do they compare with "real" values?
android {
// ...
testOptions {
unitTests.returnDefaultValues = true
}
}
Per the documentation (emphasis added):
If the exceptions thrown by Android APIs in the android.jar are problematic for your tests, you can change the behavior so that methods instead return either null or zero by adding the following configuration in your project's top-level build.gradle file:
android {
...
testOptions {
unitTests.returnDefaultValues = true
}
}
Caution: Setting the returnDefaultValues property to true should be done with care. The null/zero return values can introduce regressions in your tests, which are hard to debug and might allow failing tests to pass. Only use it as a last resort.
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