Skip to content

Commit

Permalink
Update tests to capture the failing scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaRanasinghe committed May 26, 2023
1 parent ac5a342 commit b72caf0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion asb-ballerina/tests/asb_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,15 @@ function testSendAndReceiveBatchFromQueueOperation() returns error? {
log:printInfo("Sending via Asb sender.");
check messageSender->sendBatch(messages);

// Here we set the batch size to be more than the number of messages sent.
// This is to validate whether the received message count is always same as the sent count,
// even when the expected count is larger than the sent count
log:printInfo("Receiving from Asb receiver.");
MessageBatch|error? messageReceived = messageReceiver->receiveBatch(maxMessageCount);
MessageBatch|error? messageReceived = messageReceiver->receiveBatch(messages.length() + 5);

if (messageReceived is MessageBatch) {
log:printInfo(messageReceived.toString());
test:assertEquals(messageReceived.messages.length(), messages.length(), msg = "Sent & received message counts are not equal.");
foreach Message message in messageReceived.messages {
if (message.toString() != "") {
string msg = check string:fromBytes(<byte[]>message.body);
Expand Down

0 comments on commit b72caf0

Please sign in to comment.