Android Mockito TooManyActualInvocations

Answer #1 100 %

TooManyActualInvocations means... too many actual invocations.

This has to work fine:

fun doSomethingTest() {
    Mockito.verify(mockView, times(2)).enableProgressBar(0)

As enableProgressBar was called twice with 0 argument, then the assertion should be appropriate (should assert that it was called twice). Or you can use some convenient Mockito methods such as atLeastOnce(), atMost(2), etc. instead of straightforward times if you want to leave some space for implementation specifics.

You’ll also like:

© 2023 -