Argument Matching

MXUnit allows you to mock using literal arguments or argument patterns. Imagine you have a component that sets a dozen HTTP headers. You have the option of explicitly mocking each setHeader call literaly or you can match all by specifying a pattern:

Explicit literals:

...

Using argument matching, you can mock the above like so:

MXUnit will invoke and record and calls made to setHeader(...) that have exactly two string parameters. So, you can verify that specific setHeader calls were made:

To Do: Implement recording of BOTH the pattern and literal. Currently, only the pattern is recorded so verification is not possible.

Labels

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