We currently have an object that consists of constant values only.
object Constants {
const val VERSION = V1
}
However, these constants' values may be altered in the future. Thus I want to ensure that a test breaks if certain conditions are not met by the VERSION
value. We use Mockk for mocking so I tried to mock the Constants
object according to the docs like this
mockkObject(Constants)
every { Constants.VERSION } returns -1
assertThat(Constants.VERSION).isEqualTo(-1)
Unfortunately this does not compile with the following error: io.mockk.MockKException: Missing calls inside every { ... } block.
Is there a way to mock the constant value? Or should I provide getter methods for the constants and mock these?