Template Class PublisherMock

Inheritance Relationships

Base Type

Class Documentation

template<typename MessageT>
class PublisherMock : public rtest::MockBase

A wrapper object for rclcpp::Publisher that intercepts the publish() method invocation and implements a mock for it.

Template Parameters:

MessageT

Public Functions

inline PublisherMock(rclcpp::PublisherBase *pub)
inline ~PublisherMock()
MOCK_METHOD (void, publish,(const MessageT &msg))

This is the mock method that gets called eventually from all other overloads.

inline void setSubscriptionCount(size_t count)

Set the fake subscriptions count.

Parameters:

count – number of fake subscriptions

Public Members

size_t subscriptions_count_ = {0UL}
rclcpp::PublisherBase *pub_ = {nullptr}