BewareMyPower commented on code in PR #17125:
URL: https://github.com/apache/pulsar/pull/17125#discussion_r947437276
##########
pulsar-client-cpp/tests/MessageTest.cc:
##########
@@ -99,3 +99,24 @@ TEST(MessageTest, testMessageBuilder) {
ASSERT_EQ(msg.getData(), originalAddress);
}
}
+
+TEST(MessageTest, testMessageBuilderSetKeyValueContent) {
+ std::string keyContent = "keyContent";
+ std::string valueContent = "valueContent";
+
+ // test inline encoding type.
+ {
+ KeyValue keyValue(keyContent, valueContent, INLINE);
+ const Message& message = MessageBuilder().setContent(keyValue).build();
+ ASSERT_EQ(message.getDataAsString(), keyValue.getContent());
+ ASSERT_EQ(message.getPartitionKey(), "");
+ }
+
+ // test inline encoding type.
+ {
+ KeyValue keyValue(keyContent, valueContent, SEPARATED);
+ const Message& message = MessageBuilder().setContent(keyValue).build();
+ ASSERT_EQ(message.getDataAsString(), valueContent);
+ ASSERT_EQ(message.getPartitionKey(), keyContent);
+ }
+}
Review Comment:
It's better to add a newline at the end of file. If you're using a IDE of
JetBrains, you might go to "Editor - General" and select "Ensure every saved
file ends with a line break".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]