From 6cd43f0e80824ba5ae28002e1dea5bca46e7a58c Mon Sep 17 00:00:00 2001 From: RDPerera Date: Fri, 22 Mar 2024 14:22:23 +0530 Subject: [PATCH] Migrate std:regex to lang.regexp --- ballerina/tests/asb_sender_receiver_negative_tests.bal | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ballerina/tests/asb_sender_receiver_negative_tests.bal b/ballerina/tests/asb_sender_receiver_negative_tests.bal index 385cb5b1..4c05b850 100644 --- a/ballerina/tests/asb_sender_receiver_negative_tests.bal +++ b/ballerina/tests/asb_sender_receiver_negative_tests.bal @@ -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"], enable: true, @@ -78,7 +75,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((result).message(),invalidCompleteError), msg = "Invalid Complete for " + + string:RegExp completeFailedMsg = re `^Failed to complete message with ID:.*$`; + test:assertTrue(completeFailedMsg.isFullMatch((result).message()), msg = "Invalid Complete for " + " Messages in Receive and Delete Mode"); } else if receivedMessage is () { test:assertFail("No message in the queue."); @@ -118,7 +116,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((result).message(),invalidAbandonError), msg = "Invalid Abandon for " + + string:RegExp abandonFailedMsg = re `^Failed to abandon message with ID:.*$`; + test:assertTrue(abandonFailedMsg.isFullMatch((result).message()), msg = "Invalid Abandon for " + " Messages in Receive and Delete Mode"); } else if receivedMessage is () { test:assertFail("No message in the queue.");