class MockBaseClass : public BaseClass
{
public:
// Constructor
MockBaseClass(MockDep1 * pA)
:BaseClass( pA)
{
mpA = pA;
}
MockDep1 is a mock for Dep1
BaseClass
BaseClass(Dep1 *pA)
{
..
...
mpX = new X(pA->getCollection()->getA());//crashes
}
How can I avoid this situation? I tried to make a mock for X class but I don't know how to use it because the constructor of the Base Class is called anyway.
I solved it by mocking the methods from MockDep1