Hi,
I have some code that uses a collaborator. As I’m doing an integration test I want to use the actual methods of the collaborator, but I would like to verify that they are called. Is this possible?
Example of CUT:
void function doSomething(foo){
// some code here then…
local.foo = variables.collaborator.callMe(local.foo);
variables.collaborator.whatever(local.foo);
}
Example Test:
function test_it(){
local.mocked = createMock(“com.foo. collaborator”);
variables.CUT.$property(“collaborator”, “variables”, local.mocked);
assertEquals(1, local.mocked.$count(“callMe”));
assertEquals(1, local.mocked.$count(“whatever”));
}
I didn’t know if there was a way to get Mockbox to spy on those methods without mocking them. I know you do some clever stuff where a proxy gets created and written to disk, so didn’t know if there was a way to leverage that to do a kind of AOP to record that the method was called.
Thanks,
John