I'm trying to solve my unit testing problem. I have a class with a QTcpSocket
object in it. This class has derived from the QObject
to use the signal/slot system and the socket object is used inside slots.
I have tried to mock (gmock) this socket object, but I couldn't find any solution to incorporate the mock object to my class.
I cannot do this through a template, because the MOC compiler doesn't work with templates. And I cannot create a general interface for the QTcpSocket and my mock class. Though the QAbstractSocket has virtual methods, it has non-virtual methods like waitForReadyRead()
too. That confuse me.