Ability to spy on existing methods

Description

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. Current this is no 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"));
}

Get Mockbox to spy on those methods without mocking them. Maybe do something clever by using AOP to intercept the call somehow?

Assignee

Luis Majano

Reporter

John Whish

Labels

None

Components

Fix versions

Priority

Major
Configure