Created
May 3, 2015 18:22
-
-
Save dhemery/bf4e1bd6091ba3d52fd8 to your computer and use it in GitHub Desktop.
Setting expectations on Matchers in JMock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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