Skip to content

Commit

Permalink
Fix error creation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HindujaB committed Oct 5, 2023
1 parent 9ba154d commit 7fa7796
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,7 @@ public static BError getErrorValue(BString errorTypeName) {
BString errorMsg = StringUtils.fromString("error message!");
BError bError = ErrorCreator.createError(errorModule, errorTypeName.getValue(), errorTypeName,
ErrorCreator.createError(errorMsg), ValueCreator.createMapValue());
// TODO: fix https://github.com/ballerina-platform/ballerina-lang/issues/41025
String typeName = errorTypeName.getValue().equals("ResourceDispatchingError") ?
"RequestDispatchingError" : errorTypeName.getValue();
assert bError.getType().getName().equals(typeName);
assert bError.getType().getName().equals(errorTypeName.getValue());
return bError;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public function validateAPI() {

errorVar = getErrorValue("ResourceNotFoundError");
test:assertTrue(errorVar is ResourceNotFoundError);

errorVar = getErrorValue("RequestDispatchingError");
test:assertTrue(errorVar is RequestDispatchingError);

errorVar = getErrorValue("StatusCodeError");
test:assertTrue(errorVar is StatusCodeError);
}

function getErrorValue(string errorTypeName) returns error = @java:Method {
Expand Down

0 comments on commit 7fa7796

Please sign in to comment.