Menu

#30 in some cases replay chooses the wrong matcher

closed
EasyMock (40)
6
2012-10-05
2010-01-26
No

I have an example of a mock that calls the same method twice.
Each time has a different matcher registered.
In some cases, the mock replay uses the first matcher for the second invocation, but not in all cases.
See attached.

Discussion

  • Robert Blumen

    Robert Blumen - 2010-01-26
     
  • Robert Blumen

    Robert Blumen - 2010-01-26

    The attached file depends on the junit jar.

     
  • Henri Tremblay

    Henri Tremblay - 2010-05-02

    That's not the way it works. Matchers can be called any amount of times. They will just tell if it matches or not.

    If you remove the assertEquals, the test runs as expected.

    Does it cause you a problem? To check a parameter, you should use eq() or a Capture.

     
  • Henri Tremblay

    Henri Tremblay - 2010-05-02

    I still have made a change so a matcher is not called when no results are available on a given recorded behaviour. The matcher rule is still true but EasyMock will behave more like you would expect (and I hope be a bit faster)

     

Log in to post a comment.