Package org.mockito.internal.invocation

Examples of org.mockito.internal.invocation.Invocation


    public void addConsecutiveAnswer(Answer answer) {
        addAnswer(answer, true);
    }
   
    private void addAnswer(Answer answer, boolean isConsecutive) {
        Invocation invocation = invocationForStubbing.getInvocation();
        mockingProgress.stubbingCompleted(invocation);
        AnswersValidator answersValidator = new AnswersValidator();
        answersValidator.validate(answer, invocation);
       
        if (isConsecutive) {
View Full Code Here


   
    public void check(List<Invocation> invocations, InvocationMatcher wanted) {
        List<Invocation> actualInvocations = finder.findInvocations(invocations, wanted);
       
        if (actualInvocations.isEmpty()) {
            Invocation similar = finder.findSimilarInvocation(invocations, wanted);
            if (similar != null) {
                ArgumentMatchingTool argumentMatchingTool = new ArgumentMatchingTool();
                Integer[] indexesOfSuspiciousArgs = argumentMatchingTool.getSuspiciouslyNotMatchingArgsIndexes(wanted.getMatchers(), similar.getArguments());
                SmartPrinter smartPrinter = new SmartPrinter(wanted, similar, indexesOfSuspiciousArgs);
                reporter.argumentsAreDifferent(smartPrinter.getWanted(), smartPrinter.getActual(), similar.getLocation());
            } else {
                reporter.wantedButNotInvoked(wanted, invocations);
            }
        }
    }
View Full Code Here

       
        if (!chunk.isEmpty()) {
            return;
        }
       
        Invocation previousInOrder = finder.findPreviousVerifiedInOrder(invocations);
        if (previousInOrder == null) {
            reporter.wantedButNotInvoked(wanted);
        } else {
            reporter.wantedButNotInvokedInOrder(wanted, previousInOrder);
        }
View Full Code Here

    }
   
    public void reportUsedStub(InvocationMatcher invocationMatcher) {
        Iterator<Invocation> i = unusedStubs.iterator();
        while(i.hasNext()) {
            Invocation invocation = i.next();
            if (invocationMatcher.matches(invocation)) {
                i.remove();
            }
        }
    }
View Full Code Here

    }
   
    public void print(MockitoLogger logger) {
        Iterator<Invocation> unusedIterator = unusedStubs.iterator();
        while(unusedIterator.hasNext()) {
            Invocation unused = unusedIterator.next();
            Iterator<InvocationMatcher> unstubbedIterator = unstubbedInvocations.iterator();
            while(unstubbedIterator.hasNext()) {
                InvocationMatcher unstubbed = unstubbedIterator.next();
                if(unstubbed.hasSimilarMethod(unused)) {
                    logger.log(stubbedMethodCalledWithDifferentArguments(unused, unstubbed));
View Full Code Here

import org.mockito.internal.verification.api.VerificationMode;

public class NoMoreInteractions implements VerificationMode {

    public void verify(VerificationData data) {
        Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());
       
        if (unverified != null) {
            new Reporter().noMoreInteractionsWanted(unverified);
        }
    }
View Full Code Here

    InvocationMatcher wantedMatcher = data.getWanted();
    List<Invocation> invocations = data.getAllInvocations();
    List<Invocation> chunk = finder.findInvocations(invocations,wantedMatcher);
    if (invocations.size() != 1 && chunk.size() > 0) {
      marker.markVerified(chunk.get(0), wantedMatcher);
      Invocation unverified = finder.findFirstUnverified(invocations);
      reporter.noMoreInteractionsWanted(unverified);
    } else if (invocations.size() != 1 || chunk.size() == 0) {
      reporter.wantedButNotInvoked(wantedMatcher);
    }
  }
View Full Code Here

        List<Invocation> unusedStubs = new LinkedList(this.baseUnusedStubs);
        List<InvocationMatcher> allInvocations = new LinkedList(this.baseAllInvocations);

        Iterator<Invocation> unusedIterator = unusedStubs.iterator();
        while(unusedIterator.hasNext()) {
            Invocation unused = unusedIterator.next();
            Iterator<InvocationMatcher> unstubbedIterator = allInvocations.iterator();
            while(unstubbedIterator.hasNext()) {
                InvocationMatcher unstubbed = unstubbedIterator.next();
                if(unstubbed.hasSimilarMethod(unused)) {
                    findingsListener.foundStubCalledWithDifferentArgs(unused, unstubbed);
View Full Code Here

public class NoMoreInteractions implements VerificationMode, VerificationInOrderMode {

    @SuppressWarnings("unchecked")
    public void verify(VerificationData data) {
        Invocation unverified = new InvocationsFinder().findFirstUnverified(data.getAllInvocations());                      
        if (unverified != null) {
            new Reporter().noMoreInteractionsWanted(unverified, (List) data.getAllInvocations());
        }
    }
View Full Code Here

        }
    }

    public void verifyInOrder(VerificationDataInOrder data) {
        List<Invocation> invocations = data.getAllInvocations();
        Invocation unverified = new InvocationsFinder().findFirstUnverifiedInOrder(data.getOrderingContext(), invocations);
       
        if (unverified != null) {
            new Reporter().noMoreInteractionsWantedInOrder(unverified);
        }
    }
View Full Code Here

TOP

Related Classes of org.mockito.internal.invocation.Invocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.