From 75c683f23a3142baabe665cc76010f7a0bed8b0a Mon Sep 17 00:00:00 2001 From: Berkay Karaman Date: Wed, 13 Mar 2024 15:02:17 +0300 Subject: [PATCH] feat: add nullpointer test Signed-off-by: Berkay Karaman --- .../test/src/ros/test_published_time_publisher.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/tier4_autoware_utils/test/src/ros/test_published_time_publisher.cpp b/common/tier4_autoware_utils/test/src/ros/test_published_time_publisher.cpp index 751c5f12060a9..96965114630c2 100644 --- a/common/tier4_autoware_utils/test/src/ros/test_published_time_publisher.cpp +++ b/common/tier4_autoware_utils/test/src/ros/test_published_time_publisher.cpp @@ -62,6 +62,7 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithHeader) // Use Published Time Publisher with a timestamp published_time_publisher_->publish(test_publisher_, header); rclcpp::spin_some(node_); + ASSERT_TRUE(published_time_ != nullptr); // Check if the published time is the same as the header EXPECT_EQ(published_time_->header.stamp, header.stamp); @@ -75,6 +76,7 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithTimestamp) // Use Published Time Publisher with a timestamp published_time_publisher_->publish(test_publisher_, header.stamp); rclcpp::spin_some(node_); + ASSERT_TRUE(published_time_ != nullptr); // Check if the published time is the same as the header EXPECT_EQ(published_time_->header.stamp, header.stamp);