Skip to content

Add option to check exhaustiveness automatically for all registered mocks #52

@HylkeB

Description

@HylkeB

As per the documentation, exhaustiveness is only checked for mocks that are in the verify block. However it would be nice to also have an option where the exhaustiveness is verified for all registered mocks, to make sure no unintended side effects are happening.

Example:

repository.findById("1")
repository.findById("2")
repository.findAll()
verifySuspend(exhaustiveOrder) {
    // Verification currently passes - no mock is verified
//    repository.findById(any())
//    repository.findById(any())
//    repository.findAll()
}

Would like something like this:

repository.findById("1")
repository.findById("2")
repository.findAll()
verifySuspend(allExhaustiveOrder) {
    // Verification fails - findById not verified
//    repository.findById(any())
//    repository.findById(any())
//    repository.findAll()
}

I know there is a manual call that can be executed to make sure no more calls are happening on a mock:
verifyNoMoreCalls(repository), but that is error prone as you might forget to add a newly added mock to this statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions