I have a class which accepts a pointer to another class and has a method read():
class B:
{
public:
......
void read(char * str);
......
};
class A
{
public:
A(B *bobj):b(bobj);
B* b;
void read (char * str);
..........
};
I invoke the object like below
A * aobj = new A(new B());
Now I should be able to access read method of both the classes like below:
char text[100];
b->read(text)
aobj->read(text)
The method read of both A and B class is coded to copy some values to the input array as provided.
How can I write MOCK method of the function to modify the argument to a specific value?
ON_CALL(*b, read(::testing::_)).WillByDefault(::testing::Return(outBuffer));
Gives me a compilation issue as read method cannot return a value by definition?