ios - OCMock expect a method called within another method -


this extremely basic question ocmock expectations. let's have instance method methoda on objecta calls instance method methodb on objecta.

- (void)methoda {     [self methodb]; }  - (void)methodb {     ... } 

now, let's want verify partial mock of objecta invokes methoda , methodb. seems should have is:

- (void)test {    id mockobjecta = [ocmockobject partialmockforobject:self.objecta];    [[mockobjecta expect] methoda];    [[mockobjecta expect] methodb];     [self.objecta methoda];     [mockobjecta verify]; } 

when run test, thinks methoda invoked methodb not invoked. misunderstanding?

thanks help.

you need tell mock forward method call on real object implementation run.

[[[mockobjecta expect] andforwardtorealobject] methoda]; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -