Check if there is a gradle file in your application:
android { ... testOptions { unitTests.returnDefaultValues = true }
Uri
is an Android class and, as such, cannot be used in local block tests, without the code above you get the following:
java.lang.RuntimeException: Method parse in android.net.Uri not mocked. See http://g.co/androidstudio/not-mocked for details.
The code above suppresses this exception and instead provides dummy implementations that return default values ββ( null
in this case).
Another option is that you use some framework in your tests, which provides the implementation of methods in Android classes.
source share