Muravyeva_A_B_rest_countries_tests#9
Open
MuravAna wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds JUnit integration tests that exercise the public RestCountries API endpoints and validate basic response semantics.
Changes:
- Introduces a new
RestCountriesApiTesttest class that issues real HTTP requests torestcountries.com. - Adds assertions for common endpoints (
/all,/name/*,/alpha/*) including a negative 404 case.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+22
| private static final String BASE_URL = "https://restcountries.com/v3.1"; | ||
| private static final HttpClient CLIENT = HttpClient.newBuilder() | ||
| .connectTimeout(Duration.ofSeconds(10)) | ||
| .build(); |
Comment on lines
+68
to
+73
| @Test | ||
| @DisplayName("GET /all возвращает непустой список стран") | ||
| void allReturnsNonEmptyList() throws Exception { | ||
| JsonNode countries = getArray("/all"); | ||
| assertTrue(countries.size() > 0); | ||
| } |
Comment on lines
+96
to
+103
| @Test | ||
| @DisplayName("GET /all возвращает страны с population больше нуля") | ||
| void allCountriesHavePositivePopulation() throws Exception { | ||
| JsonNode countries = getArray("/all"); | ||
| for (JsonNode country : countries) { | ||
| assertTrue(country.path("population").asLong(0) > 0); | ||
| } | ||
| } |
Comment on lines
+96
to
+103
| @Test | ||
| @DisplayName("GET /all возвращает страны с population больше нуля") | ||
| void allCountriesHavePositivePopulation() throws Exception { | ||
| JsonNode countries = getArray("/all"); | ||
| for (JsonNode country : countries) { | ||
| assertTrue(country.path("population").asLong(0) > 0); | ||
| } | ||
| } |
Comment on lines
+75
to
+87
| @Test | ||
| @DisplayName("GET /name/russia возвращает страну со столицей Moscow") | ||
| void russiaHasMoscowCapital() throws Exception { | ||
| JsonNode countries = getArray("/name/russia"); | ||
| assertTrue(containsCapital(countries, "Moscow")); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("GET /alpha/de возвращает страну Germany") | ||
| void alphaDeReturnsGermany() throws Exception { | ||
| JsonNode countries = getArray("/alpha/de"); | ||
| assertTrue(containsCommonName(countries, "Germany")); | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.