Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Jun 12, 2024
1 parent 98b410c commit aceee23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit aceee23

Please sign in to comment.