Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Sep 20, 2023
1 parent cbf82c5 commit 177717a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected Response getResponseOfGet(String endpointUri) {
* @return Response of post request.
*/
protected Response getResponseOfPost(String endpointUri, String body) {

return given().auth().preemptive().basic(authenticatingUserName, authenticatingCredential)
.contentType(ContentType.JSON)
.header(HttpHeaders.ACCEPT, ContentType.JSON)
Expand Down Expand Up @@ -140,7 +141,7 @@ protected void validateErrorResponse(Response response, int httpStatusCode, Stri
}

/**
* Validate http status code of the response
* Validate http status code of the response.
*
* @param response Response.
* @param httpStatusCode Expected status code.
Expand All @@ -155,7 +156,7 @@ protected void validateHttpStatusCode(Response response, int httpStatusCode) {
}

/**
* Validate error description of the response, if an entry is available in RESTAPIErrors.properties
* Validate error description of the response, if an entry is available in RESTAPIErrors.properties.
*
* @param response Response.
* @param errorCode Error code.
Expand All @@ -179,7 +180,7 @@ private void validateErrorMessage(Response response, String errorCode) {
}

/**
* Validate elements in error response against entries in RESTAPIErrors.properties
* Validate elements in error response against entries in RESTAPIErrors.properties.
*
* @param response Response.
* @param errorCode API error code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void init(ITestContext context) throws Exception {
orgId = SUPER_ORGANIZATION_ID;
}
this.subOrganizationId = orgId;
if (this.organizationType.name().equals("SUPER_ORGANIZATION")) {
if (OrganizationType.SUPER_ORGANIZATION.equals(this.organizationType)) {
super.testInitWithoutTenantQualifiedPath(API_VERSION, swaggerDefinition);
} else {
this.tenant = subOrganizationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.wso2.identity.integration.test.rest.api.server.organization.management.v1;

import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.testng.annotations.AfterMethod;
Expand Down Expand Up @@ -52,7 +53,7 @@ public void testCreateOrganizationWithoutRequiredField() throws Exception {
JSONObject organizationObject = new JSONObject();
String parentId;

if (organizationType.name().equals("SUPER_ORGANIZATION")) {
if (OrganizationType.SUPER_ORGANIZATION.equals(this.organizationType)) {
parentId = SUPER_ORGANIZATION_NAME;
} else {
parentId = subOrganizationId;
Expand All @@ -70,12 +71,12 @@ public void testCreateOrganizationWithABlankName() throws Exception {
JSONObject organizationObject = new JSONObject();
String parentId;

if (organizationType.name().equals("SUPER_ORGANIZATION")) {
if (OrganizationType.SUPER_ORGANIZATION.equals(this.organizationType)) {
parentId = SUPER_ORGANIZATION_NAME;
} else {
parentId = subOrganizationId;
}
organizationObject.put(ORGANIZATION_NAME, "");
organizationObject.put(ORGANIZATION_NAME, StringUtils.EMPTY);
organizationObject.put(ORGANIZATION_PARENT_ID, parentId);
String payload = organizationObject.toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void createOrganization() throws Exception {
String org;
String parentId;

if (organizationType.name().equals("SUPER_ORGANIZATION")) {
if (OrganizationType.SUPER_ORGANIZATION.equals(this.organizationType)) {
org = "Level1Org";
parentId = SUPER_ORGANIZATION_NAME;
} else {
Expand Down

0 comments on commit 177717a

Please sign in to comment.