@@ -40,7 +40,7 @@
Loading
40 40
                    new Discrepancy(wantedCount, actualCount), wanted, allLocations);
41 41
        }
42 42
        if (wantedCount == 0 && actualCount > 0) {
43 -
            throw neverWantedButInvoked(wanted, getAllLocations(actualInvocations));
43 +
            throw neverWantedButInvoked(wanted, actualInvocations);
44 44
        }
45 45
        if (wantedCount < actualCount) {
46 46
            throw tooManyActualInvocations(

@@ -10,9 +10,7 @@
Loading
10 10
11 11
import java.lang.reflect.Field;
12 12
import java.lang.reflect.Method;
13 -
import java.util.ArrayList;
14 -
import java.util.Collection;
15 -
import java.util.List;
13 +
import java.util.*;
16 14
17 15
import org.mockito.exceptions.base.MockitoAssertionError;
18 16
import org.mockito.exceptions.base.MockitoException;
@@ -408,14 +406,15 @@
Loading
408 406
    }
409 407
410 408
    public static MockitoAssertionError neverWantedButInvoked(
411 -
            DescribedInvocation wanted, List<Location> invocations) {
409 +
            DescribedInvocation wanted, List<Invocation> invocations) {
410 +
412 411
        return new NeverWantedButInvoked(
413 412
                join(
414 413
                        wanted.toString(),
415 414
                        "Never wanted here:",
416 415
                        new LocationImpl(),
417 416
                        "But invoked here:",
418 -
                        createAllLocationsMessage(invocations)));
417 +
                        createAllLocationsArgsMessage(invocations)));
419 418
    }
420 419
421 420
    public static MockitoAssertionError tooManyActualInvocationsInOrder(
@@ -439,6 +438,21 @@
Loading
439 438
        return sb.toString();
440 439
    }
441 440
441 +
    private static String createAllLocationsArgsMessage(List<Invocation> invocations) {
442 +
        StringBuilder sb = new StringBuilder();
443 +
        for (Invocation invocation : invocations) {
444 +
            Location location = invocation.getLocation();
445 +
            if (location == null) {
446 +
                continue;
447 +
            }
448 +
            sb.append(location)
449 +
                    .append(" with arguments: ")
450 +
                    .append(Arrays.toString(invocation.getArguments()))
451 +
                    .append("\n");
452 +
        }
453 +
        return sb.toString();
454 +
    }
455 +
442 456
    private static String createTooFewInvocationsMessage(
443 457
            org.mockito.internal.reporting.Discrepancy discrepancy,
444 458
            DescribedInvocation wanted,
Files Complexity Coverage
src/main/java/org/mockito 85.51% 84.81%
subprojects 79.06% 84.61%
Project Totals (326 files) 85.42% 84.81%
Notifications are pending CI completion. Waiting for GitHub's status webhook to queue notifications. Push notifications now.
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading