What is the difference between using verify(exactly = 0)
and using wasNot called
assertions of MockK when testing Kotlin?
I have an example where the former passes the test but the latter yields:
java.lang.AssertionError: Verification failed: call 1 of 1: KLogger(#1).error(any())) was not called.
Code sample:
private val logger = mockk<KLogger>()
...
@Test
fun `logMessage should log message with info log level`() {
...
every { logger.info(logMessage) } just runs
...
verify(exactly = 1) { logger.info(logMessage) }
verify { logger.error(any<String>()) wasNot Called }
}