Examples of VerificationMode


Examples of org.mockito.verification.VerificationMode

   
    @Test
    public void shouldStartVerificationAndPullVerificationMode() throws Exception {
        assertNull(mockingProgress.pullVerificationMode());
       
        VerificationMode mode = VerificationModeFactory.times(19);
       
        mockingProgress.verificationStarted(mode);
       
        assertSame(mode, mockingProgress.pullVerificationMode());
       
View Full Code Here

Examples of org.mockito.verification.VerificationMode

                    invocation
            );
            invocationContainerImpl.setMethodForStubbing(invocationMatcher);
            return null;
        }
        VerificationMode verificationMode = mockingProgress.pullVerificationMode();

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

        mockingProgress.validateState();

        // if verificationMode is not null then someone is doing verify()
        if (verificationMode != null) {
            // We need to check if verification was started on the correct mock
            // - see VerifyingWithAnExtraCallToADifferentMockTest (bug 138)
            // TODO: can I avoid this cast here?
            if (((MockAwareVerificationMode) verificationMode).getMock() == invocation.getMock()) {
                VerificationDataImpl data = new VerificationDataImpl(invocationContainerImpl, invocationMatcher);
                verificationMode.verify(data);
                return null;
            } else {
                // this means there is an invocation on a different mock. Re-adding verification mode
                // - see VerifyingWithAnExtraCallToADifferentMockTest (bug 138)
                mockingProgress.verificationStarted(verificationMode);
View Full Code Here

Examples of org.mockito.verification.VerificationMode

    public VerificationMode pullVerificationMode() {
        if (verificationMode == null) {
            return null;
        }
       
        VerificationMode temp = verificationMode.getObject();
        verificationMode = null;
        return temp;
    }
View Full Code Here

Examples of org.mockito.verification.VerificationMode

    // when
    visitor.runPass();

    // then
    VerificationMode error = lenient ? never() : times(1);
    VerificationMode warning = lenient ? times(1) : never();

    verify(errorManager, error).report(any(GssError.class));
    verify(errorManager, warning).reportWarning(any(GssError.class));
  }
View Full Code Here

Examples of org.mockito.verification.VerificationMode

    // when
    visitor.runPass();

    // then
    VerificationMode error = lenient ? never() : times(1);
    VerificationMode warning = lenient ? times(1) : never();

    verify(errorManager, error).report(any(GssError.class));
    verify(errorManager, warning).reportWarning(any(GssError.class));
  }
View Full Code Here

Examples of org.mockito.verification.VerificationMode

  /**
   * {@inheritDoc}
   */
  public synchronized Object verify(Object... mocks) {
    final VerificationMode verificationMode;
    Object mode = MockRepository.getAdditionalState("VerificationMode");
    if (mode != null) {
      if (mode instanceof VerificationMode) {
        verificationMode = (VerificationMode) mode;
      } else {
View Full Code Here

Examples of org.mockito.verification.VerificationMode

        }
        return returnValue;
    }

    private void handleStaticVerification(Class<?> cls) {
        VerificationMode verificationMode = getVerificationMode();
        if (verificationMode instanceof StaticMockAwareVerificationMode) {
            ((StaticMockAwareVerificationMode) verificationMode).setClassMock(cls);
        }
    }
View Full Code Here

Examples of org.mockito.verification.VerificationMode

    public VerificationMode pullVerificationMode() {
        if (verificationMode == null) {
            return null;
        }
       
        VerificationMode temp = verificationMode.getObject();
        verificationMode = null;
        return temp;
    }
View Full Code Here

Examples of org.mockito.verification.VerificationMode

            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();

        //if verificationMode is not null then someone is doing verify()       
        if (verificationMode != null) {
            //We need to check if verification was started on the correct mock
            // - see VerifyingWithAnExtraCallToADifferentMockTest (bug 138)
            //TODO: can I avoid this cast here?
            if (((MockAwareVerificationMode) verificationMode).getMock() == invocation.getMock()) {               
                VerificationDataImpl data = new VerificationDataImpl(invocationContainerImpl, invocationMatcher);           
                verificationMode.verify(data);
                return null;
            } else {
                // this means there is an invocation on a different mock. Re-adding verification mode
                // - see VerifyingWithAnExtraCallToADifferentMockTest (bug 138)
                mockingProgress.verificationStarted(verificationMode);
View Full Code Here

Examples of org.mockito.verification.VerificationMode

  /**
   * {@inheritDoc}
   */
  public synchronized Object verify(Object... mocks) {
    final VerificationMode verificationMode;
    Object mode = MockRepository.getAdditionalState("VerificationMode");
    if (mode != null) {
      if (mode instanceof VerificationMode) {
        verificationMode = (VerificationMode) mode;
      } else {
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.