Okay, I've only just started working with JMock.
@Test
public void shouldTestSomething() {
final Subscriber subscriber = mockery.mock(Subscriber.class);
final Callback callback = mockery.mock(Callback.class);
mockery.checking(new Expectations() {
{
one(subscriber).subscribe(callback);
ignoring(callback);
}
});
Workflow workflow = new Workflow(subscriber, callback);
}
I'm testing that subscribe is called, but I don't care what happens to callback.
It seems like it would be nicer to have the following test:
@Test
public void shouldTestSomethingElse() {
final Subscriber subscriber = mockery.mock(Subscriber.class);
mockery.checking(new Expectations() {
{
one(subscriber).subscribe(with(any(Callback.class)));
}
});
Workflow workflow = new Workflow(subscriber, mockery.stub(Callback.class));
}
Is there something already in JMock that will allow me to do that?
Cheers, Jay