简体   繁体   中英

C++ : Is it possible to write Mock class for a class with parameterized constructor

I am using Google Mock framework to develop unit test cases. For all the classes that have default constructors, I am able to write a mock class and mock the required methods. But is it possible for us to write a mock class for a class with no default constructor/ with a constructor but with parameters?

is it possible for us to write a mock class for a class with no default constructor/ with a constructor but with parameters?

Definitiely yes! I have already written such mock classes.

Do you have particular problems? Then show and make them clear please.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM