jeudi 24 janvier 2019

How to mock Build.VERSION.SDK_INT using mockk

How can I mock Build.VERSION.SDK_INT in mockk?

I've done the following:

@Test
fun testFoo(){
    mockkStatic(Build::class)
    mockkStatic(Build.VERSION::class)
    every {
        Build.VERSION.SDK_INT
    } answers { 22 }
}

I end up getting io.mockk.MockKException: Missing calls inside every { ... } block. once the code hits the every block.

Aucun commentaire:

Enregistrer un commentaire