Menu

#25 Use a single MocksControl for multiple mock types

EasyMock_2.5
open
EasyMock (33)
5
2012-10-05
2009-06-12
No

It would be convenient if we could use a single mock control to simultaneously control nice, default and strict mocks simultaneously.

It is common for our unit tests to want to use different mock types in a single test. For example, we might inject a "nice" logger mock, and a "strict" data-access mock. Since this behavior is not supported by EasyMock's MocksControl class as of EasyMock 2.4, we have written our own class to suit our needs (attached).

It would be ideal if there were functionality built into EasyMock which made this custom class unnecessary. This might come either as a modification to MocksControl, or as a new class which extends the functionality of MocksControl.

Discussion

  • Aaron Pieper

    Aaron Pieper - 2009-06-12

    Our custom "EasyMockMaker" class, which mostly duplicates MocksControl but adds the functionality for multiple mock types

     
  • Henri Tremblay

    Henri Tremblay - 2009-08-18

    IMocksControl creates related mocks. For instance, they are ordered with one another in case of a strict IMocksControl.

    What you want is some kind of mock factory to be able de replay and verify quickly. That's requested a lot. I'm not quite sure of the best way to do so but I'll look into it.

     
  • Anonymous

    Anonymous - 2011-10-17

    This feature request appears to be fulfilled by the new EasyMockSupport class. I think this tracker can be closed.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.