From aceee23e0aef7ce43ecdaf3a74ba1755fb12344d Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 12 Jun 2024 10:54:55 +0530 Subject: [PATCH] Fix test cases --- .../http/compiler/CompilerPluginTest.java | 37 +++++++------------ .../compiler/CompilerPluginTestConstants.java | 1 - 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTest.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTest.java index 3d6fc2edda..e2f57d478f 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTest.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTest.java @@ -133,16 +133,6 @@ public void testInValidReturnTypes() { "'anydata|http:Response|http:StatusCodeResponse|error', but found 'readonly & error[]'", HTTP_102); } - @Test - public void testInValidAnnotations() { - Package currentPackage = loadPackage("sample_package_3"); - PackageCompilation compilation = currentPackage.getCompilation(); - DiagnosticResult diagnosticResult = compilation.diagnosticResult(); - Assert.assertEquals(diagnosticResult.errorCount(), 1); - assertError(diagnosticResult, 0, "invalid resource method annotation type: expected 'http:ResourceConfig', " + - "but found 'display '", CompilerPluginTestConstants.HTTP_103); - } - @Test public void testInValidInputPayloadArgs() { Package currentPackage = loadPackage("sample_package_4"); @@ -410,22 +400,21 @@ public void testResourceErrorPositions() { Package currentPackage = loadPackage("sample_package_15"); PackageCompilation compilation = currentPackage.getCompilation(); DiagnosticResult diagnosticResult = compilation.diagnosticResult(); - Assert.assertEquals(diagnosticResult.errorCount(), 14); + Assert.assertEquals(diagnosticResult.errorCount(), 13); // only testing the error locations assertErrorPosition(diagnosticResult, 0, "(29:44,29:60)"); - assertErrorPosition(diagnosticResult, 1, "(34:5,34:12)"); - assertErrorPosition(diagnosticResult, 2, "(42:86,42:87)"); - assertErrorPosition(diagnosticResult, 3, "(46:57,46:60)"); - assertErrorPosition(diagnosticResult, 4, "(50:63,50:66)"); - assertErrorPosition(diagnosticResult, 5, "(54:66,54:69)"); - assertErrorPosition(diagnosticResult, 6, "(58:77,58:80)"); - assertErrorPosition(diagnosticResult, 7, "(62:76,62:79)"); - assertErrorPosition(diagnosticResult, 8, "(66:76,66:82)"); - assertErrorPosition(diagnosticResult, 9, "(73:45,73:46)"); - assertErrorPosition(diagnosticResult, 10, "(81:43,81:46)"); - assertErrorPosition(diagnosticResult, 11, "(81:61,81:64)"); - assertErrorPosition(diagnosticResult, 12, "(81:79,81:82)"); - assertErrorPosition(diagnosticResult, 13, "(85:77,85:93)"); + assertErrorPosition(diagnosticResult, 1, "(42:86,42:87)"); + assertErrorPosition(diagnosticResult, 2, "(46:57,46:60)"); + assertErrorPosition(diagnosticResult, 3, "(50:63,50:66)"); + assertErrorPosition(diagnosticResult, 4, "(54:66,54:69)"); + assertErrorPosition(diagnosticResult, 5, "(58:77,58:80)"); + assertErrorPosition(diagnosticResult, 6, "(62:76,62:79)"); + assertErrorPosition(diagnosticResult, 7, "(66:76,66:82)"); + assertErrorPosition(diagnosticResult, 8, "(73:45,73:46)"); + assertErrorPosition(diagnosticResult, 9, "(81:43,81:46)"); + assertErrorPosition(diagnosticResult, 10, "(81:61,81:64)"); + assertErrorPosition(diagnosticResult, 11, "(81:79,81:82)"); + assertErrorPosition(diagnosticResult, 12, "(85:77,85:93)"); } @Test diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java index 6eb81f72d8..555781b659 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java @@ -26,7 +26,6 @@ private CompilerPluginTestConstants() {} public static final String HTTP_101 = "HTTP_101"; public static final String HTTP_102 = "HTTP_102"; - public static final String HTTP_103 = "HTTP_103"; public static final String HTTP_104 = "HTTP_104"; public static final String HTTP_105 = "HTTP_105"; public static final String HTTP_106 = "HTTP_106";