@@ -91,8 +91,8 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithHeader)
91
91
std_msgs::msg::Header header;
92
92
header.stamp = rclcpp::Time (1234 );
93
93
94
- // Use Published Time Publisher .publish () with a header
95
- published_time_publisher_->publish (first_test_publisher_, header);
94
+ // Use Published Time Publisher .publish_if_subscribed () with a header
95
+ published_time_publisher_->publish_if_subscribed (first_test_publisher_, header);
96
96
rclcpp::spin_some (node_);
97
97
98
98
// Check if the published_time_ is created
@@ -110,8 +110,8 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithTimestamp)
110
110
std_msgs::msg::Header header;
111
111
header.stamp = rclcpp::Time (4321 );
112
112
113
- // Use Published Time Publisher .publish () with a timestamp
114
- published_time_publisher_->publish (first_test_publisher_, header.stamp );
113
+ // Use Published Time Publisher .publish_if_subscribed () with a timestamp
114
+ published_time_publisher_->publish_if_subscribed (first_test_publisher_, header.stamp );
115
115
rclcpp::spin_some (node_);
116
116
117
117
// Check if the published_time_ is created
@@ -129,9 +129,9 @@ TEST_F(PublishedTimePublisherTest, MultiplePublishMsgWithHeader)
129
129
std_msgs::msg::Header header;
130
130
header.stamp = rclcpp::Time (12345 );
131
131
132
- // Use Published Time Publisher .publish () with a header for multiple publishers
133
- published_time_publisher_->publish (first_test_publisher_, header);
134
- published_time_publisher_->publish (second_test_publisher_, header);
132
+ // Use Published Time Publisher .publish_if_subscribed () with a header for multiple publishers
133
+ published_time_publisher_->publish_if_subscribed (first_test_publisher_, header);
134
+ published_time_publisher_->publish_if_subscribed (second_test_publisher_, header);
135
135
rclcpp::spin_some (node_);
136
136
137
137
// Check if the published_time_ is created
@@ -151,9 +151,9 @@ TEST_F(PublishedTimePublisherTest, MultiplePublishMsgWithTimestamp)
151
151
std_msgs::msg::Header header;
152
152
header.stamp = rclcpp::Time (12345 );
153
153
154
- // Use Published Time Publisher .publish () with a timestamp for multiple publishers
155
- published_time_publisher_->publish (first_test_publisher_, header.stamp );
156
- published_time_publisher_->publish (second_test_publisher_, header.stamp );
154
+ // Use Published Time Publisher .publish_if_subscribed () with a timestamp for multiple publishers
155
+ published_time_publisher_->publish_if_subscribed (first_test_publisher_, header.stamp );
156
+ published_time_publisher_->publish_if_subscribed (second_test_publisher_, header.stamp );
157
157
rclcpp::spin_some (node_);
158
158
159
159
// Check if the published_time_ is created
0 commit comments