From 3e017eccd7048db165a8f5251eb9b3eb9e502eea Mon Sep 17 00:00:00 2001 From: Thushara-Piyasekara Date: Tue, 9 Apr 2024 18:22:58 +0530 Subject: [PATCH] Update tests with new error message --- .../test/javainterop/basic/StaticMethodTest.java | 5 +++-- .../annotations/annotation_access_negative.bal | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/javainterop/basic/StaticMethodTest.java b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/javainterop/basic/StaticMethodTest.java index 4b56dddbe92e..8151a11969a7 100644 --- a/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/javainterop/basic/StaticMethodTest.java +++ b/tests/jballerina-unit-test/src/test/java/org/ballerinalang/test/javainterop/basic/StaticMethodTest.java @@ -169,9 +169,10 @@ public void testCreateRawDetails() { } @Test(expectedExceptions = BLangTestException.class, - expectedExceptionsMessageRegExp = ".*Invalid update of record field: modification not allowed on readonly " + - "value.*") + expectedExceptionsMessageRegExp = "error: \\{ballerina/lang.map}InherentTypeViolation \\{\"message\":" + + "\"cannot update 'readonly' field 'name' in record of type 'Details & readonly'\".*") public void testCreateDetails() { + BRunUtil.invoke(result, "testCreateDetails"); } diff --git a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/annotation_access_negative.bal b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/annotation_access_negative.bal index 462145a9f1c9..c3fa341d4c0b 100644 --- a/tests/jballerina-unit-test/src/test/resources/test-src/annotations/annotation_access_negative.bal +++ b/tests/jballerina-unit-test/src/test/resources/test-src/annotations/annotation_access_negative.bal @@ -47,8 +47,8 @@ function testRecordTypeAnnotationReadonlyValueEdit() { assertEquality(true, res is error); error resError = res; - assertEquality("{ballerina/lang.map}InvalidUpdate", resError.message()); - assertEquality("Invalid update of record field: modification not allowed on readonly value", + assertEquality("{ballerina/lang.map}InherentTypeViolation", resError.message()); + assertEquality("cannot update 'readonly' field 'foo' in record of type 'Annot & readonly'", resError.detail()["message"]); } @@ -73,8 +73,8 @@ function testAnnotationOnObjectTypeReadonlyValueEdit() { assertEquality(true, res is error); error resError = res; - assertEquality("{ballerina/lang.map}InvalidUpdate", resError.message()); - assertEquality("Invalid update of record field: modification not allowed on readonly value", + assertEquality("{ballerina/lang.map}InherentTypeViolation", resError.message()); + assertEquality("cannot update 'readonly' field 'foo' in record of type 'Annot & readonly'", resError.detail()["message"]); } @@ -97,8 +97,8 @@ function testAnnotationOnFunctionTypeReadonlyValueEdit() { assertTrue(res is error); error resError = res; - assertEquality("{ballerina/lang.map}InvalidUpdate", resError.message()); - assertEquality("Invalid update of record field: modification not allowed on readonly value", + assertEquality("{ballerina/lang.map}InherentTypeViolation", resError.message()); + assertEquality("cannot update 'readonly' field 'foo' in record of type 'Annot & readonly'", resError.detail()["message"]); }