Examples of InvocationMatcher


Examples of com.caucho.server.dispatch.InvocationMatcher

    if (uriPattern != null)
      uriMatcher = Pattern.compile(uriPattern).matcher("");
    else
      uriMatcher = null;

    InvocationMatcher matcher = new InvocationMatcher() {
      public boolean isMatch(Invocation invocation)
      {
        if (hostMatcher != null) {
          hostMatcher.reset(invocation.getHost());
          if (! hostMatcher.find()) {
View Full Code Here

Examples of org.infinispan.test.concurrent.InvocationMatcher

      advancedCache(0).lock(KEY);
      sequencer.exit("tx:perform_op");
   }

   private void startRebalance() throws Exception {
      InvocationMatcher rebalanceCompletedMatcher = matchMethodCall("handleRebalanceCompleted")
            .withParam(1, address(2)).build();
      advanceOnGlobalComponentMethod(sequencer, manager(0), ClusterTopologyManager.class,
            rebalanceCompletedMatcher).before("rebalance:before_confirm");

      InvocationMatcher localRebalanceMatcher = matchMethodCall("handleRebalance").build();
      advanceOnGlobalComponentMethod(sequencer, manager(2), LocalTopologyManager.class,
            localRebalanceMatcher).before("rebalance:before_get_tx").after("rebalance:after_get_tx");
      consistentHashFactory.setOwnerIndexes(2, 1);
      consistentHashFactory.triggerRebalance(cache(0));
   }
View Full Code Here

Examples of org.jmock.core.InvocationMatcher

        Iterator i = matchers.iterator();
        boolean needSeparator = false;
        boolean lastWasMethodName = false;

        while (i.hasNext()) {
            InvocationMatcher matcher = (InvocationMatcher)i.next();

            if (!matcher.hasDescription()) continue;

            if (matcher instanceof MethodNameMatcher) {
                if (!needSeparator) buffer.append("stub"); // first matcher
                buffer.append(": ");
                lastWasMethodName = true;
            } else if( matcher instanceof ArgumentsMatcher ) {
                if (needSeparator && !lastWasMethodName) buffer.append(SEP);
                lastWasMethodName = false;

            } else {
                if (needSeparator) buffer.append(SEP);
                lastWasMethodName = false;
            }
           
            matcher.describeTo(buffer);
            needSeparator = true;
        }

        if (needSeparator) buffer.append(SEP);
        stub.describeTo(buffer);
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

   
    public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        if (mockitoStubber.hasAnswersForStubbing()) {
            //stubbing voids with stubVoid() or doAnswer() style
            Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);
            mockitoStubber.setMethodForStubbing(invocationMatcher);
            return null;
        }
       
        VerificationMode verificationMode = mockingProgress.pullVerificationMode();
        mockingProgress.validateState();

        Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);

        if (verificationMode != null) {
            VerificationDataImpl data = new VerificationDataImpl(registeredInvocations.getAll(), invocationMatcher);
            verificationMode.verify(data);
            return null;
        }

        mockitoStubber.setInvocationForPotentialStubbing(invocationMatcher);
        registeredInvocations.add(invocationMatcher.getInvocation());

        mockingProgress.reportOngoingStubbing(new OngoingStubbingImpl());

        Answer<?> answer = mockitoStubber.findAnswerFor(invocation);
        if (answer != null) {
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

   
    public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        if (mockitoStubber.hasAnswersForStubbing()) {
            //stubbing voids in the old-school way: stubVoid()
            Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);
            mockitoStubber.setMethodForStubbing(invocationMatcher);
            return null;
        }
       
        VerificationModeImpl verificationMode = mockingProgress.pullVerificationMode();
        mockingProgress.validateState();

        Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);

        if (verificationMode != null) {
            //verifying
            verifyingRecorder.verify(invocationMatcher, verificationMode);
            return null;
        }

        mockitoStubber.setInvocationForPotentialStubbing(invocationMatcher);
        verifyingRecorder.recordInvocation(invocationMatcher.getInvocation());

        mockingProgress.reportOngoingStubbing(new OngoingStubbingImpl());

        if (mockitoStubber.hasResultFor(invocation)) {
            return mockitoStubber.getResultFor(invocation);
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

    }
   
    public Object handle(Invocation invocation) throws Throwable {
        if (mockitoStubber.hasAnswersForStubbing()) {
            //stubbing voids with stubVoid() or doAnswer() style
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(mockingProgress.getArgumentMatcherStorage(), invocation);
            mockitoStubber.setMethodForStubbing(invocationMatcher);
            return null;
        }
        VerificationMode verificationMode = mockingProgress.pullVerificationMode();

        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(mockingProgress.getArgumentMatcherStorage(), invocation);
       
        mockingProgress.validateState();

        if (verificationMode != null) {
            VerificationDataImpl data = new VerificationDataImpl(registeredInvocations.getAll(), invocationMatcher);
            verificationMode.verify(data);
            return null;
        }

        registeredInvocations.add(invocationMatcher.getInvocation());
        mockitoStubber.setInvocationForPotentialStubbing(invocationMatcher);
        OngoingStubbingImpl<T> ongoingStubbing = new OngoingStubbingImpl<T>(mockitoStubber, registeredInvocations);
        mockingProgress.reportOngoingStubbing(ongoingStubbing);

        StubbedInvocationMatcher stubbedInvocation = mockitoStubber.findAnswerFor(invocation);
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

  private final InvocationMarker marker = new InvocationMarker();
  private final Reporter reporter = new Reporter();

  @SuppressWarnings("unchecked")
    public void verify(VerificationData data) {
    InvocationMatcher wantedMatcher = data.getWanted();
    List<Invocation> invocations = data.getAllInvocations();
    List<Invocation> chunk = finder.findInvocations(invocations,wantedMatcher);
    if (invocations.size() != 1 && chunk.size() > 0) {     
      Invocation unverified = finder.findFirstUnverified(invocations);
      reporter.noMoreInteractionsWanted(unverified, (List) invocations);
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

        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);
                    unusedIterator.remove();
                    unstubbedIterator.remove();
                }
            }
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

    }

    public Object handle(Invocation invocation) throws Throwable {
    if (invocationContainerImpl.hasAnswersForStubbing()) {
            // stubbing voids with stubVoid() or doAnswer() style
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(
                    mockingProgress.getArgumentMatcherStorage(),
                    invocation
            );
            invocationContainerImpl.setMethodForStubbing(invocationMatcher);
            return null;
        }
        VerificationMode verificationMode = mockingProgress.pullVerificationMode();

        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(
                mockingProgress.getArgumentMatcherStorage(),
                invocation
        );

        mockingProgress.validateState();
View Full Code Here

Examples of org.mockito.internal.invocation.InvocationMatcher

    }

    public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        if (stubber.hasThrowableForVoidMethod()) {
            Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);
            stubber.addVoidMethodForThrowable(invocationMatcher);
            return null;
        }
       
        VerificationModeImpl verificationMode = mockingProgress.pullVerificationMode();
        mockingProgress.validateState();
       
        Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);
       
        if (verificationMode != null) {
            verifyingRecorder.verify(invocationMatcher, verificationMode);
            return Configuration.instance().getReturnValues().valueFor(invocationMatcher.getInvocation());
        }
       
        stubber.setInvocationForPotentialStubbing(invocationMatcher);
        verifyingRecorder.recordInvocation(invocationMatcher.getInvocation());

        mockingProgress.reportOngoingStubbing(new OngoingStubbingImpl());
       
        return stubber.resultFor(invocationMatcher.getInvocation());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.