Question on passing arguments to mocked methods

4 views
Skip to first unread message

zach

unread,
Apr 8, 2009, 5:03:37 PM4/8/09
to gmock-user
In jmock, i can do this:

one.(mock).someMethod(with(any(MyClass.class)

How can i do this in gmock?



Johnny

unread,
Apr 8, 2009, 9:34:57 PM4/8/09
to gmock...@googlegroups.com
You can do like:

mock.someMethod(match { it instanceof MyClass })

Or:

mock.someMethod(is(instanceOf(MyClass)))
mock.someMethod(instanceOf(MyClass))
mock.someMethod(is(MyClass))

Here "is()" and "instanceOf()" are org.hamcrest.Matchers.is() and
org.hamcrest.Matchers.instanceOf()

在 2009-04-08三的 14:03 -0700,zach写道:

zach

unread,
Apr 9, 2009, 1:20:33 PM4/9/09
to gmock-user
Perfect, thanks.
Reply all
Reply to author
Forward
0 new messages