Mocking and Stubbing

(Note that this feature is available in MXUnit 2.x and later)

MXUnit now offers a built-in, simple, lightweight framework for mocking component interactions; this is also known as MightyMock. It provides you the ability to easily and quickly define behaviors for dependencies, including both mocking and stubbing. When mocking, selective verification is possible, and when stubbing you can define return data or throw exceptions.

One slick feature is the ability to match invocations by argument pattern. This gives you the flexibility to specify either literal arguments or patterns in your mock. More on this in the Argument Matching section.

Prefer or already use another mocking framework like MockBox? No problem! When using MXUnit's mocking syntax, you can tell it to use the mocking framework of your choice.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.