Skip to content

Instantly share code, notes, and snippets.

@blogdarkspot
Created July 18, 2017 01:34
Show Gist options
  • Save blogdarkspot/a01d70abac7822bd1b18c8d92ef73214 to your computer and use it in GitHub Desktop.
Save blogdarkspot/a01d70abac7822bd1b18c8d92ef73214 to your computer and use it in GitHub Desktop.
class ActiveMQManagerInterface
{
public:
virtual void connectToServer() = 0;
virtual void sendMessageToServer() = 0;
virtual bool isConnected() = 0;
virtual bool start() = 0;
virtual bool stop() = 0;
virtual void addQueue(const std::string&) = 0;
virtual ~ActiveMQManagerInterface()
{
}
};
class ActiveMQManagerFake : public ActiveMQManagerInterface {
public:
virtual void connectToServer() {
};
virtual void sendMessageToServer() {
};
virtual bool isConnected() {
return true;
};
virtual bool start() {
return true;
};
virtual bool stop() {
return true;
};
virtual void addQueue(const std::string&) {
};
};
class ActiveMQManagerMock : public ActiveMQManagerInterface {
private:
ActiveMQManagerFake fake;
public:
MOCK_METHOD0(getInstance, ActiveMQManagerInterface*());
MOCK_METHOD0(isConnected, bool());
MOCK_METHOD0(start, bool());
MOCK_METHOD0(stop, bool());
MOCK_METHOD1(addQueue, void(const string&));
MOCK_METHOD0(connectToServer, void());
MOCK_METHOD0(sendMessageToServer, void());
void delegateToFake()
{
ON_CALL(*this, connectToServer()).WillByDefault(Invoke(&fake, &ActiveMQManagerFake::connectToServer));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment