Last active
March 18, 2019 19:53
-
-
Save robfletcher/430b03bee30d68f2cff2055fc9122977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.mockk.Called | |
import io.mockk.every | |
import io.mockk.mockk | |
import io.mockk.verify | |
import org.junit.jupiter.api.Test | |
import java.util.function.Consumer | |
import java.util.function.Supplier | |
class NullOrUnitWasNotCalled { | |
@Test | |
fun unitFnWasNotCalled() { | |
val consumer: Consumer<String> = mockk(relaxUnitFun = true) | |
verify { consumer.accept(any()) wasNot Called } | |
} | |
@Test | |
fun nullFnWasNotCalled() { | |
val supplier: Supplier<String?> = mockk() | |
verify { supplier.get()?.wasNot(Called) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
java.lang.AssertionError: Verification failed: call 1 of 1: Consumer(#7).accept(any())) was not called
java.lang.AssertionError: Verification failed: call 1 of 1: Supplier(#4).get()) was not called