mockito-kotlin
mockito-kotlin copied to clipboard
Mock Android Secure static method
trafficstars
My code:
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID).toLowerCase()
and I'm trying to mock it
Mockito.mockStatic(Settings.Secure::class.java).use { utilities ->
utilities.`when`<Any> { Settings.Secure.getString(anyVararg(), anyVararg()) }.thenReturn("test")
}
Error :
getString must not be null
java.lang.NullPointerException: getString must not be null
mockito vesrion - 4.0.0