Skip to content

Instantly share code, notes, and snippets.

@dhemery
Created May 3, 2015 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhemery/bf4e1bd6091ba3d52fd8 to your computer and use it in GitHub Desktop.
Save dhemery/bf4e1bd6091ba3d52fd8 to your computer and use it in GitHub Desktop.
Setting expectations on Matchers in JMock
new Expectations() {{
// allowing(matcher) treats the matcher not as the receiver,
// but as a matcher on receivers, so must use same(matcher)
//
// No matches(input) is available, so must use method("matches")
//
// No with(input) is available, so must use with(equalTo(input))
allowing(same(matcher)).method("matches").with(equalTo(input));
will(returnValue(false));
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment