-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What changes are proposed in this pull request? I refactor `RestApiTest` and `TestCase`. I wrap the method to create `TestCase` instance. ### Why are the changes needed? In the former, every unit test creates a `TestCase` instance like this. ``` HttpURLConnection connection = new TestCase(mHostname, mPort, mBaseUri, bucketUri, NO_PARAMS, HttpMethod.PUT, options).execute(); Assert.assertEquals(Response.Status.CONFLICT.getStatusCode(), connection.getResponseCode()); S3Error response = new XmlMapper().readerFor(S3Error.class).readValue(connection.getErrorStream()); Assert.assertEquals(S3ErrorCode.Name.BUCKET_ALREADY_EXISTS, response.getCode()); ``` It's too ugly and unreadable. now you can use the following instead of above. ``` createBucketTestCase(bucketName).checkResponseCode(Status.CONFLICT.getStatusCode()) .checkErrorCode(S3ErrorCode.Name.BUCKET_ALREADY_EXISTS); ``` ### Does this PR introduce any user facing changes? none. pr-link: #17775 change-id: cid-bf3fb6b1675ef6c2d755e04a5ee746e191530885
- Loading branch information
Showing
5 changed files
with
154 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.