From 1409c16e8852e65eabe11810e842c0ee8e39ccf0 Mon Sep 17 00:00:00 2001 From: dan-du-car Date: Thu, 6 Jul 2023 15:47:27 +0000 Subject: [PATCH] add unit test --- .../TmxUtils/test/test_kafka_producer_worker.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tmx/TmxUtils/test/test_kafka_producer_worker.cpp b/src/tmx/TmxUtils/test/test_kafka_producer_worker.cpp index 28aaf6159..ca04a1e19 100644 --- a/src/tmx/TmxUtils/test/test_kafka_producer_worker.cpp +++ b/src/tmx/TmxUtils/test/test_kafka_producer_worker.cpp @@ -15,3 +15,18 @@ TEST(test_kafka_producer_worker, create_producer) worker->send(msg); worker->stop(); } + +TEST(test_kafka_producer_worker, create_producer_no_topic) +{ + std::string broker_str = "localhost:9092"; + std::string topic = "test"; + auto client = std::make_shared(); + std::shared_ptr worker; + worker = client->create_producer(broker_str); + worker->init(); + worker->printCurrConf(); + std::string msg = "test message"; + // // Run this unit test without launching kafka broker will throw connection refused error + worker->send(msg, topic); + worker->stop(); +} \ No newline at end of file