Skip to content

Muravyeva_A_B_rest_countries_tests#9

Open
MuravAna wants to merge 1 commit into
hse-java-classes:mainfrom
MuravAna:main
Open

Muravyeva_A_B_rest_countries_tests#9
MuravAna wants to merge 1 commit into
hse-java-classes:mainfrom
MuravAna:main

Conversation

@MuravAna
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 23, 2026 10:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RestCountriesApiTest test class that issues real HTTP requests to restcountries.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"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants