2

using mockk for unit test, and would like to mock the BuilConfig.DEBUG.

        io.mockk.mockkObject(BuildConfig::class) // or mockkStatic
        io.mockk.every { BuildConfig.DEBUG } returns true //<=== throws

but it throws exception

Missing mocked calls inside every { ... } block: make sure the object inside the block is a mock

How to mock the BuildConfig.DEBUG using mockk?

lannyf
  • 9,865
  • 12
  • 70
  • 152
  • It is best to wrap those kind of stuffs. https://github.com/mockk/mockk/issues/107#issuecomment-456325979 – ocos Jul 19 '22 at 19:37
  • looking for native mokk solution. besides there is some functionalities controlled by code that are in 3rd part lib and cannt change the code there. – lannyf Jul 19 '22 at 19:42

0 Answers0