Skip to content

Commit

Permalink
Fix test failures from error response improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharika Madurapperuma committed Sep 20, 2024
1 parent 72377d1 commit 006896a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ protected String createAPIRevisionAndDeployUsingRest(String apiId, RestAPIPublis
throws ApiException, JSONException, APIManagerIntegrationTestException {
int HTTP_RESPONSE_CODE_OK = Response.Status.OK.getStatusCode();
int HTTP_RESPONSE_CODE_CREATED = Response.Status.CREATED.getStatusCode();
int HTTP_RESPONSE_CODE_BAD_REQUEST = Response.Status.BAD_REQUEST.getStatusCode();
int HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode();
String revisionUUID = null;
//Add the API Revision using the API publisher.
Expand All @@ -860,8 +861,9 @@ protected String createAPIRevisionAndDeployUsingRest(String apiId, RestAPIPublis
apiRevisionRequest.setDescription("Test Revision 1");

HttpResponse apiRevisionResponse = restAPIPublisher.addAPIRevision(apiRevisionRequest);

if (apiRevisionResponse.getResponseCode() != HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR) {
int responseCode = apiRevisionResponse.getResponseCode();
if (responseCode != HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR && responseCode
!= HTTP_RESPONSE_CODE_BAD_REQUEST) {
assertEquals(apiRevisionResponse.getResponseCode(), HTTP_RESPONSE_CODE_CREATED,
"Create API Response Code is invalid." + apiRevisionResponse.getData());
JSONObject jsonObject = new JSONObject(apiRevisionResponse.getData());
Expand Down

0 comments on commit 006896a

Please sign in to comment.