Search in sources :

Example 1 with DescribedInvocation

use of org.mockito.invocation.DescribedInvocation in project mockito by mockito.

the class Reporter method wantedButNotInvoked.

public static MockitoAssertionError wantedButNotInvoked(DescribedInvocation wanted, List<? extends DescribedInvocation> invocations) {
    String allInvocations;
    if (invocations.isEmpty()) {
        allInvocations = "Actually, there were zero interactions with this mock.\n";
    } else {
        StringBuilder sb = new StringBuilder("\nHowever, there " + were_exactly_x_interactions(invocations.size()) + " with this mock:\n");
        for (DescribedInvocation i : invocations) {
            sb.append(i.toString()).append("\n").append(i.getLocation()).append("\n\n");
        }
        allInvocations = sb.toString();
    }
    String message = createWantedButNotInvokedMessage(wanted);
    return new WantedButNotInvoked(message + allInvocations);
}
Also used : DescribedInvocation(org.mockito.invocation.DescribedInvocation)

Aggregations

DescribedInvocation (org.mockito.invocation.DescribedInvocation)1