Skip to content

Fail when a mock is called outside of exhaustive verify #23

Closed Answered by lupuuss
Cedrick84 asked this question in Q&A
Discussion options

You must be logged in to vote

I know what you mean. However, implementing this check automatically is problematic. For a reference, Mockk acts the same in given scenario. Maybe with compiler plugin capabilities it could be possible, but it's not easy to do and probably error-prone.
Also, you can eliminate partially the boilerplate with AfterTest:

@AfterTest
fun after() {
   verifyNoMoreCalls(dep1, dep2, dep3)
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Cedrick84
Comment options

@lupuuss
Comment options

Answer selected by Cedrick84
@Cedrick84
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants