Skip to content

Commit

Permalink
Improve integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UdeshAthukorala committed Oct 9, 2023
1 parent 5816fd6 commit f4920b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ public void testDeleteNotExistingCustomTextPreference() {

Response response = getResponseOfDelete(CUSTOM_TEXT_API_BASE_PATH + QUERY_PARAM_SEPARATOR +
String.format(SCREEN_QUERY_PARAM, LOGIN_SCREEN));
validateErrorResponse(response, HttpStatus.SC_NOT_FOUND, "BPM-60006");
response.then()
.log().ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_NO_CONTENT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,11 @@ public void testAddCustomTextPreference() throws IOException, JSONException {
String location = response.getHeader(HttpHeaders.LOCATION);
assertNotNull(location);

JSONObject expectedPreference = new JSONObject(new JSONObject(readResource("add-custom-text.json")).
get("preference").toString());
JSONObject expectedPreference = new JSONObject(new JSONObject(body).get("preference").toString());
JSONObject receivedPreference = new JSONObject(new JSONObject(response.asString()).
get("preference").toString());
Assert.assertTrue(areJSONObjectsEqual(expectedPreference, receivedPreference),
"The custom text preference schema of the Response is incorrect");
"The custom text preference schema of the Response is incorrect.");
}

@Test(dependsOnMethods = {"testAddCustomTextPreference"})
Expand All @@ -360,7 +359,7 @@ public void testGetCustomTextPreference() throws IOException, JSONException {
JSONObject receivedPreference = new JSONObject(new JSONObject(response.asString()).
get("preference").toString());
Assert.assertTrue(areJSONObjectsEqual(expectedPreference, receivedPreference),
"The custom text preference schema of the Response is incorrect");
"The custom text preference schema of the Response is incorrect.");
}

@Test(dependsOnMethods = {"testGetCustomTextPreference"})
Expand Down Expand Up @@ -400,8 +399,7 @@ public void testUpdateCustomTextPreference() throws IOException, JSONException {
.body("screen", equalTo(LOGIN_SCREEN))
.body("locale", equalTo(DEFAULT_LOCALE));

JSONObject expectedPreference = new JSONObject(new JSONObject(readResource("update-custom-text.json")).
get("preference").toString());
JSONObject expectedPreference = new JSONObject(new JSONObject(body).get("preference").toString());
JSONObject receivedPreference = new JSONObject(new JSONObject(response.asString()).
get("preference").toString());
Assert.assertTrue(areJSONObjectsEqual(expectedPreference, receivedPreference),
Expand Down

0 comments on commit f4920b1

Please sign in to comment.