Skip to content

Commit

Permalink
Add org name validation for MetadataTest
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanWeerasinghe committed Jul 22, 2024
1 parent 39fd6ad commit 513a1db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*/
public class MetadataTest {

private static final String ORG_NAME = "orgName";
private static final String PACKAGE_NAME = "packageName";
private static final String PATH = "path";
private static final String KIND = "kind";
Expand Down Expand Up @@ -76,11 +77,21 @@ private void compareResponse(String projectName, String response) {
Assert.assertNull(responseJsonObject.getAsJsonPrimitive(PACKAGE_NAME),
"Package MetadataTest " + PACKAGE_NAME + " fails with " + projectName + " test case.");
}
Assert.assertEquals(responseJsonObject.getAsJsonPrimitive(KIND),
expectedJsonObject.getAsJsonPrimitive(KIND),

JsonPrimitive projectKind = expectedJsonObject.getAsJsonPrimitive(KIND);
Assert.assertEquals(responseJsonObject.getAsJsonPrimitive(KIND), projectKind,
"Package MetadataTest " + KIND + " fails with " + projectName + " test case.");
Assert.assertNotNull(responseJsonObject.getAsJsonPrimitive(PATH),
"Package MetadataTest " + PATH + " fails with " + projectName + " test case.");

Assert.assertNotNull(responseJsonObject.getAsJsonPrimitive(ORG_NAME),
"Package MetadataTest " + ORG_NAME + " fails with " + projectName + " test case.");

if (projectKind != null && !"SINGLE_FILE_PROJECT".equals(projectKind.getAsString())) {
Assert.assertEquals(responseJsonObject.getAsJsonPrimitive(ORG_NAME),
expectedJsonObject.getAsJsonPrimitive(ORG_NAME),
"Package MetadataTest " + ORG_NAME + " fails with " + projectName + " test case.");
}
}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"orgName": "wso2",
"packageName": "project_functions",
"kind": "BUILD_PROJECT",
"path": "file:///"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"orgName": "bob",
"packageName": "project_services",
"kind": "BUILD_PROJECT",
"path": "file:///"
Expand Down

0 comments on commit 513a1db

Please sign in to comment.