Skip to content

Commit

Permalink
Migrate std:regex to lang.regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
RDPerera committed Mar 22, 2024
1 parent d89880e commit d5fd26c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ballerina/tests/asb_sender_receiver_negative_tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

import ballerina/log;
import ballerina/test;
import ballerina/regex;

string invalidCompleteError = "^Failed to complete message with ID:.*$";
string invalidAbandonError = "^Failed to abandon message with ID:.*$";
@test:Config {
groups: ["asb_sender_receiver_negative"],
dependsOn: [testCreateQueue, testCreateTopicOperation, testCreateSubscription]
Expand Down Expand Up @@ -76,7 +73,8 @@ function testInvalidComplete() returns error? {
log:printInfo("messgae" + receivedMessage.toString());
Error? result = messageReceiver->complete(receivedMessage);
test:assertTrue(result is error, msg = "Unexpected Complete for Messages in Receive and Delete Mode");
test:assertTrue(regex:matches((<Error>result).message(),invalidCompleteError), msg = "Invalid Complete for " +
string:RegExp completeFailedMsg = re `^Failed to complete message with ID:.*$`;
test:assertTrue(completeFailedMsg.isFullMatch((<Error>result).message()), msg = "Invalid Complete for " +
" Messages in Receive and Delete Mode");
} else if receivedMessage is () {
test:assertFail("No message in the queue.");
Expand Down Expand Up @@ -116,7 +114,8 @@ function testInvalidAbandon() returns error? {
log:printInfo("messgae" + receivedMessage.toString());
Error? result = messageReceiver->abandon(receivedMessage);
test:assertTrue(result is error, msg = "Unexpected Abandon for Messages in Receive and Delete Mode");
test:assertTrue(regex:matches((<Error>result).message(),invalidAbandonError), msg = "Invalid Abandon for " +
string:RegExp abandonFailedMsg = re `^Failed to abandon message with ID:.*$`;
test:assertTrue(abandonFailedMsg.isFullMatch((<Error>result).message()), msg = "Invalid Abandon for " +
" Messages in Receive and Delete Mode");
} else if receivedMessage is () {
test:assertFail("No message in the queue.");
Expand Down

0 comments on commit d5fd26c

Please sign in to comment.