Argument Matching - mxunit/mxunit GitHub Wiki
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:
<cfset mock.setHeader('X-Foo','Bar').returns() />
<cfset mock.setHeader('X-Bar','Foo').returns() />
<cfset mock.setHeader('X-Name','Mouse').returns() />
<cfset mock.setHeader('X-Value','Cheese').returns() />
Using argument matching, you can mock the above like so:
<cfset mock.myCollaborator.setHeader('{string}','{string}').returns() />
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:
<cfset mock.verify().setHeader('X-Value','Cheese') />
To Do: Implement recording of BOTH the pattern and literal. Currently, only the pattern is recorded so verification is not possible.