First I mock an object. Then I do something that should make the object's certain method be called. The call is asynchronous.
So what I'd like to verify is: in at most 5 seconds, this method of the mock object should be called.
Any idea?
First I mock an object. Then I do something that should make the object's certain method be called. The call is asynchronous.
So what I'd like to verify is: in at most 5 seconds, this method of the mock object should be called.
Any idea?
Copyright © 2021 Jogjafile Inc.
OCMockito doesn't support asynchronous verification (yet). Until it does, I'd recommend using a hand-rolled mock instead, and OCHamcrest's
assertWithTimeout.For example, here's a hand-rolled mock to confirm that
fooBarwas called:Then with OCHamcrest: