|
1 | 1 | package com.amadeus.referencedata.locations; |
2 | 2 |
|
3 | 3 | import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; |
| 4 | +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; |
4 | 5 | import static com.github.tomakehurst.wiremock.client.WireMock.get; |
5 | 6 | import static com.github.tomakehurst.wiremock.client.WireMock.post; |
6 | 7 | import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; |
| 8 | +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; |
7 | 9 | import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; |
| 10 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
8 | 11 | import static org.junit.jupiter.api.Assertions.assertNotEquals; |
9 | 12 |
|
10 | 13 | import com.amadeus.Amadeus; |
@@ -74,6 +77,27 @@ public void givenClientWhenCallCitySearchWithParamsThenOK() |
74 | 77 | assertNotEquals(0, result.length); |
75 | 78 | } |
76 | 79 |
|
| 80 | + @Test |
| 81 | + public void givenClientWhenCallCitySearchWithParamsThenEmpty() throws ResponseException { |
| 82 | + |
| 83 | + // Given |
| 84 | + String address = "/v1/reference-data/locations/cities"; |
| 85 | + wireMockServer.stubFor(get(urlPathEqualTo(address)) |
| 86 | + .withQueryParam("keyword", equalTo("SANC")) |
| 87 | + .withQueryParam("countryCode", equalTo("AZ")) |
| 88 | + .willReturn(aResponse().withHeader("Content-Type", "application/json") |
| 89 | + .withStatus(200) |
| 90 | + .withBodyFile("city_search_response_empty.json"))); |
| 91 | + |
| 92 | + Params params = Params.with("keyword", "SANC").and("countryCode", "AZ"); |
| 93 | + |
| 94 | + // When |
| 95 | + City[] result = amadeus.referenceData.locations.cities.get(params); |
| 96 | + |
| 97 | + // Then |
| 98 | + assertEquals(0, result.length); |
| 99 | + } |
| 100 | + |
77 | 101 | @Test |
78 | 102 | public void givenClientWhenCallCitySearchWithoutParamsThenOK() |
79 | 103 | throws ResponseException { |
|
0 commit comments