1
votes

I've coded a custom jmock action that just stores away a complicated bean, and then later on I use conventional JUnit assertions to validate it.

Is there a straightforward means in JMock expectations to assert the values returned from several getters called on an object passed to a function of the mocked interface?

1

1 Answers

3
votes

I'm not sure that goes with the grain of JMock design. For the record, you can combine multiple matchers for a single object with allOf()

oneOf(foo).wasCalled(with(allOf(hasProperty("bar", equalTo(1)),
                                hasProperty("fizz", stringContains("buzz"))));

that's a bit ugly, so I usually package up the construction of the expectation in a helper method