Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2007 Mockito contributors
  * This program is made available under the terms of the MIT License.
  */
 package org.mockito.internal.verification.checkers;
 
 import java.util.List;
 
public class MissingInvocationChecker {
    
    private final Reporter reporter;
    private final InvocationsFinder finder;
    
    public MissingInvocationChecker() {
        this(new InvocationsFinder(), new Reporter());
    }
    
    MissingInvocationChecker(InvocationsFinder finderReporter reporter) {
        this. = finder;
        this. = reporter;
    }
    
    public void check(List<InvocationinvocationsInvocationMatcher wanted) {
        List<InvocationactualInvocations = .findInvocations(invocationswanted);
        
        if (actualInvocations.isEmpty()) {
            Invocation similar = .findSimilarInvocation(invocationswanted);
            if (similar != null) {
                ArgumentMatchingTool argumentMatchingTool = new ArgumentMatchingTool();
                Integer[] indexesOfSuspiciousArgs = argumentMatchingTool.getSuspiciouslyNotMatchingArgsIndexes(wanted.getMatchers(), similar.getArguments());
                SmartPrinter smartPrinter = new SmartPrinter(wantedsimilarindexesOfSuspiciousArgs);
                .argumentsAreDifferent(smartPrinter.getWanted(), smartPrinter.getActual(), similar.getLocation());
            } else {
                .wantedButNotInvoked(wantedinvocations);
            }
        }
    }
New to GrepCode? Check out our FAQ X