Skip to content

Commit d15c78a

Browse files
committed
improve tests
1 parent e34fd54 commit d15c78a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

tests/MessageChunkingTest.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "WaitUtils.h"
2929
#include "lib/ChunkMessageIdImpl.h"
3030
#include "lib/LogUtils.h"
31+
#include "tests/VariantHelper.h"
3132

3233
DECLARE_LOG_OBJECT()
3334

@@ -105,11 +106,13 @@ TEST_F(MessageChunkingTest, testInvalidConfig) {
105106
Producer producer;
106107
ASSERT_EQ(ResultInvalidConfiguration, client.createProducer("xxx", conf, producer));
107108

108-
auto variant = client.createProducerV2("xxx", conf);
109-
const auto* error = std::get_if<Error>(&variant);
110-
ASSERT_TRUE(error != nullptr);
111-
ASSERT_EQ(ResultInvalidConfiguration, error->result);
112-
ASSERT_EQ("Batching and chunking of messages can't be enabled together", error->message);
109+
std::visit(overloaded{[](Error&& error) {
110+
ASSERT_EQ(ResultInvalidConfiguration, error.result);
111+
ASSERT_EQ("Batching and chunking of messages can't be enabled together",
112+
error.message);
113+
},
114+
[](auto&&) { FAIL(); }},
115+
client.createProducerV2("xxx", conf));
113116

114117
client.close();
115118
}

0 commit comments

Comments
 (0)