How does android.unitTests.returnDefaultValues ​​work?

I know what needs to be done in the Android build.gradle project. But how does it work? And what kind of default values ​​are returned? How do they compare with "real" values?

android { // ... testOptions { unitTests.returnDefaultValues = true } } 
+5
source share
1 answer

In the documentation (highlighted by me):

If the exceptions thrown by the Android APIs in android.jar are problematic for your tests, you can change the behavior so that the methods return zero or zero instead by adding the following top-level build.gradle file to your project:

 android { ... testOptions { unitTests.returnDefaultValues = true } } 

Caution: setting the returnDefaultValues ​​property to true should be done with caution. The null / zero return values ​​may introduce regressions in your tests, which are difficult to debug and may skip tests with errors. Use it only as a last resort.

+8
source

All Articles