0

When creating a stub in OCMockito, I use calls like this to stub out method calls and their return values:

[given([stubObject myMethod]) willReturn:someValue];

The problem I have is that if I don't define a method an that method gets called during the test, the default seems to be to return nil. This can lead to sneaky bugs since my real methods are asserted never to return nil and therefore the return value is not tested in the code calling the method.

Is there a way to change this default behavior or maybe to test if anything was called on the object apart from the few methods I'm stubbing?

Didier Malenfant
  • 729
  • 1
  • 10
  • 25

1 Answers1

0

No, OCMockito stubs are always "nice". If you want "strict" stubs, OCMock may suit you better.

Jon Reid
  • 20,545
  • 2
  • 64
  • 95
  • Thanks Jon I'll look into OCMock. Any chance of this ever becoming an option in OCMockito (like with an ```anything()``` kind of parameter or something like that) or would that be too much of a mess given the current implementation? – Didier Malenfant Apr 23 '15 at 16:06