Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2544 #2545

Merged
merged 4 commits into from Jan 18, 2022
Merged

Issue 2544 #2545

merged 4 commits into from Jan 18, 2022

Commits on Jan 18, 2022

  1. Issue-2544 Fixed bug when more than 2 invocations in Mockito.mockCons…

    …tructionWithAnswer().
    
    If you build a mockConstructionWithAnswer with more than 1 additionalAnswers there was a logic error
    whereby the method would return the wrong value when making the second last invocation. It would
    accidentally think it's at the end an only return the last answer, never returning the second
    last answer when it should.
    
    The changes I made to ConstructionMockTest.java now exercises this condition.
    johnpyeatt committed Jan 18, 2022
    Copy the full SHA
    b28643b View commit details
    Browse the repository at this point in the history
  2. Fixes mockito#2544 - when more than 2 invocations in Mockito.mockCons…

    …tructionWithAnswer().
    
    If you build a mockConstructionWithAnswer with more than 1 additionalAnswers there was a logic error
    whereby the method would return the wrong value when making the second last invocation. It would
    accidentally think it's at the end an only return the last answer, never returning the second
    last answer when it should.
    
    The changes I made to ConstructionMockTest.java now exercises this condition.
    johnpyeatt committed Jan 18, 2022
    Copy the full SHA
    7f4e5d1 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    8912892 View commit details
    Browse the repository at this point in the history
  4. Fixed mockito#2544 unit test change based on request from TimvdLippe

    I restored testConstructionMockDefaultAnswer() in ConstructionMockTest
    to it's original 2-invocation form.
    
    I added new test, testConstructionMockDefaultAnswerMultipleMoreThanTwo()
    to demonstrate the code is now fixed when more than 2 invocations
    are in place.
    johnpyeatt committed Jan 18, 2022
    Copy the full SHA
    49f8551 View commit details
    Browse the repository at this point in the history