Does one you already succeed to mock Build.VERSION...
# mockk
a
Does one you already succeed to mock Build.VERSION.SDK_INT ?
t
You could try mocking
android.os.SystemProperties
and control the return for
getInt( "ro.build.version.sdk", 0)
. I am not an android developer and this is a guess based on limited research.
a
@tKw thanks, but I do not want run InstrumentationTest, I target unit kotlin test. So I think I need to mock a more direct access either Version or directly the field.
t
That appears to be the method call for getting the value of
Build.VERSION.SDK_INT
. That is where I would start at least. What have you attempted so far?
a
SystemProperties is not accessible in Java, and in Kotlin this is a final private object
430 Views