I have a situation where I want to check if a mock object method was called with parameter X, but the test gets access to X only after the mock is invoked, so I can't set an EXPECT_CALL beforehand.
E.g.
class Maker
{
void register(Listener& lis);
Obj& make(); // Will invoke a registered listener with the newly created object, which it will also return.
}
// The test
Listener lis;
Maker maker;
maker.register(lis);
Obj& o = maker.make();
// Check that lis was invoked using param o...how?
Can i do this with google mocks? What is the most elegant / readable way of doing this?
Aucun commentaire:
Enregistrer un commentaire