Skip to content

Commit 786b3f1

Browse files
committed
rename integration tests methods
1 parent fa4bd82 commit 786b3f1

24 files changed

+100
-171
lines changed

src/test/java/com/amadeus/HTTPClientThreadSafeIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void run() {
118118
* @throws InterruptedException A possible error with the Executor
119119
*/
120120
@Test
121-
public void given_client_when_call_in_parallel_multiple_times_then_thread_safety()
121+
public void givenClienWhenCallInParallelMultipleTimesThenThreadSafety()
122122
throws InterruptedException {
123123

124124
//Given
@@ -165,7 +165,7 @@ public void given_client_when_call_in_parallel_multiple_times_then_thread_safety
165165
* @throws InterruptedException A possible error with CompletableFuture
166166
*/
167167
@Test
168-
public void given_client_when_call_in_parallel_multiple_times_then_thread_safety2()
168+
public void givenClientWhenCallInParallelMultipleTimesThenThreadSafety2()
169169
throws InterruptedException {
170170

171171
//Given

src/test/java/com/amadeus/airline/DestinationsIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_airline_destinations_with_mandatory_params_then_ok()
57+
public void givenClientWhenCallAirlineDestinationsWithMandatoryParamsThenOk()
5858
throws ResponseException {
5959

6060
//Given
@@ -75,7 +75,7 @@ public void given_client_when_call_airline_destinations_with_mandatory_params_th
7575
}
7676

7777
@Test
78-
public void given_client_when_call_airline_destinations_with_optional_params_then_ok()
78+
public void givenClientWhenCallAirlineDestinationsWithOptionalParamsThenOK()
7979
throws ResponseException {
8080

8181
//Given
@@ -99,7 +99,7 @@ public void given_client_when_call_airline_destinations_with_optional_params_the
9999

100100
//TODO Review with the team to upgrade the behaviour.
101101
@Test
102-
public void given_client_when_call_airline_destinations_without_params_then_ok() {
102+
public void givenClientWhenCallAirlineDestinationsWithoutParamsThenOK() {
103103

104104
//Given
105105
String address = "/v1/airline/destinations";

src/test/java/com/amadeus/booking/FlightOrdersIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void teardown() {
6464
}
6565

6666
@Test
67-
public void given_client_when_call_flight_offers_with_params_then_ok()
67+
public void givenClientWhenCallFlightOffersWithParamsThenOK()
6868
throws ResponseException, IOException {
6969

7070
//Given
@@ -135,7 +135,7 @@ private Traveler[] getTravelerData() {
135135
}
136136

137137
@Test
138-
public void given_client_when_call_flight_offers_with_params_alternative_2_then_ok()
138+
public void givenClientWhenCallFlightOffersWithParamsAlternative2ThenOK()
139139
throws ResponseException, IOException {
140140

141141
//Given
@@ -165,7 +165,7 @@ public void given_client_when_call_flight_offers_with_params_alternative_2_then_
165165
}
166166

167167
@Test
168-
public void given_client_when_call_flight_offers_with_params_alternative_3_then_ok()
168+
public void givenClientWhenCallFlightOffersWithParamsAlternative3ThenOK()
169169
throws ResponseException, IOException {
170170

171171
//Given
@@ -195,7 +195,7 @@ public void given_client_when_call_flight_offers_with_params_alternative_3_then_
195195
}
196196

197197
@Test
198-
public void given_client_when_call_flight_offers_with_params_alternative_4_then_ok()
198+
public void givenClientWhenCallFlightOffersWithParamsAlternative4ThenOK()
199199
throws ResponseException, IOException {
200200

201201
//Given

src/test/java/com/amadeus/dutyOfCare/diseases/Covid19ReportIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_travel_restrictions_v2_with_params_then_ok()
57+
public void givenClientWhenCallTravelRestrictionsV2WithParamsThenOK()
5858
throws ResponseException {
5959

6060
//Given
@@ -76,7 +76,7 @@ public void given_client_when_call_travel_restrictions_v2_with_params_then_ok()
7676

7777
//TODO Review with the team to upgrade the behaviour.
7878
@Test
79-
public void given_client_when_call_travel_restrictions_v2_without_params_then_ok() {
79+
public void givenClientWhenCallTravelRestrictionsV2WithoutParamsThenOK() {
8080

8181
//Given
8282
String address = "/v2/duty-of-care/diseases/covid19-area-report";

src/test/java/com/amadeus/referenceData/locations/CitiesIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_city_search_with_params_then_ok()
57+
public void givenClientWhenCallCitySearchWithParamsThenOK()
5858
throws ResponseException {
5959

6060
//Given
@@ -74,7 +74,7 @@ public void given_client_when_call_city_search_with_params_then_ok()
7474
}
7575

7676
@Test
77-
public void given_client_when_call_city_search_without_params_then_ok()
77+
public void givenClientWhenCallCitySearchWithoutParamsThenOK()
7878
throws ResponseException {
7979

8080
//Given

src/test/java/com/amadeus/referenceData/locations/HotelIT.java

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.BDDAssertions.then;
88

9+
import java.io.IOException;
10+
import java.net.URLEncoder;
11+
import java.nio.charset.StandardCharsets;
12+
import java.util.ArrayList;
13+
import java.util.List;
14+
import java.util.stream.Collectors;
15+
916
import com.amadeus.Amadeus;
1017
import com.amadeus.Params;
1118
import com.amadeus.exceptions.ResponseException;
1219
import com.amadeus.resources.Hotel;
13-
20+
import com.amadeus.resources.HotelOfferSearch;
1421
import com.github.tomakehurst.wiremock.WireMockServer;
1522
import org.junit.jupiter.api.AfterEach;
1623
import org.junit.jupiter.api.BeforeEach;
@@ -54,7 +61,7 @@ public void teardown() {
5461
}
5562

5663
@Test
57-
public void given_client_when_call_hotel_with_mandatory_parameters_then_returns_ok()
64+
public void givenClientWhenCallHotelWithMandatoryParametersThenReturnsOK()
5865
throws ResponseException {
5966

6067
//Given
@@ -78,7 +85,7 @@ public void given_client_when_call_hotel_with_mandatory_parameters_then_returns_
7885
}
7986

8087
@Test
81-
public void given_client_when_call_hotel_then_returns_single_hotel_response_ok()
88+
public void givenClientWhenCallHotelThenReturnsSingleHotelResponseOK()
8289
throws ResponseException {
8390

8491
//Given
@@ -103,7 +110,7 @@ public void given_client_when_call_hotel_then_returns_single_hotel_response_ok()
103110
}
104111

105112
@Test
106-
public void given_client_when_call_hotel_then_returns_multiple_hotel_response_ok()
113+
public void givenClientWhenCallHotelThenReturnsMultipleHotelResponseOK()
107114
throws ResponseException {
108115

109116
//Given
@@ -128,7 +135,7 @@ public void given_client_when_call_hotel_then_returns_multiple_hotel_response_ok
128135
}
129136

130137
@Test
131-
public void given_client_when_call_hotel_with_all_parameters_then_response_ok()
138+
public void givenClientWhenCallHotelWithAllParametersThenResponseOK()
132139
throws ResponseException {
133140

134141
//Given
@@ -153,4 +160,43 @@ public void given_client_when_call_hotel_with_all_parameters_then_response_ok()
153160
then(result).isNotNull();
154161
then(result.length).isGreaterThan(1);
155162
}
163+
164+
@Test
165+
public void givenClientWhenCallHotelOffersSearchWithParamsThenOK()
166+
throws ResponseException, IOException {
167+
168+
//Given
169+
String input = URLEncoder.encode("MCLONGHM,WIMAD079", "UTF-8");
170+
String address = "/v3/shopping/hotel-offers"
171+
+ "?hotelIds=" + input
172+
+ "&roomQuantity=1"
173+
+ "&adults=1"
174+
+ "&checkInDate=2022-11-22"
175+
+ "&paymentPolicy=NONE"
176+
+ "&bestRateOnly=true";
177+
wireMockServer.stubFor(get(urlEqualTo(address))
178+
.willReturn(aResponse().withHeader("Content-Type", "application/json")
179+
.withStatus(200)
180+
.withBodyFile("hotel_offers_search_response_ok.json")));
181+
182+
// ***** HERE *****
183+
List<String> ids = new ArrayList<String>();
184+
ids.add("MCLONGHM");
185+
ids.add("WIMAD079");
186+
String idsToStr1 = String.join(",", ids);
187+
// String idsToStr2 = ids.stream().map(String::valueOf).collect(Collectors.joining(","));
188+
189+
//When
190+
HotelOfferSearch[] result = amadeus.shopping.hotelOffersSearch.get(
191+
Params.with("hotelIds", idsToStr1) // ***** HERE *****
192+
.and("adults", 1)
193+
.and("checkInDate", "2022-11-22")
194+
.and("roomQuantity", 1)
195+
.and("paymentPolicy", "NONE")
196+
.and("bestRateOnly", true)
197+
);
198+
199+
//Then
200+
then(result.length).isNotEqualTo(0);
201+
}
156202
}

src/test/java/com/amadeus/referenceData/locations/PointOfInterestIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void teardown() {
5151
}
5252

5353
@Test
54-
public void given_client_when_call_point_of_interest_by_id_then_ok()
54+
public void givenClientWhenCallPointOfInterestByIdThenOK()
5555
throws ResponseException {
5656

5757
//Given

src/test/java/com/amadeus/referenceData/locations/hotels/ByCityIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_hotels_by_city_with_params_then_ok()
57+
public void givenClientWhenCallHotelsByCityWithParamsThenOK()
5858
throws ResponseException {
5959

6060
//Given
@@ -76,7 +76,7 @@ public void given_client_when_call_hotels_by_city_with_params_then_ok()
7676

7777
//TODO Review with the team to upgrade the behaviour.
7878
@Test
79-
public void given_client_when_call_hotels_by_city_without_params_then_ok()
79+
public void givenClientWhenCallHotelsByCityWithoutParamsThenOK()
8080
throws ResponseException {
8181

8282
//Given

src/test/java/com/amadeus/referenceData/locations/hotels/ByGeocodeIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_hotels_by_geocode_with_params_then_ok()
57+
public void givenClientWhenCallHotelsByGeocodeWithParamsThenOK()
5858
throws ResponseException {
5959

6060
//Given
@@ -82,7 +82,7 @@ public void given_client_when_call_hotels_by_geocode_with_params_then_ok()
8282

8383
//TODO Review with the team to upgrade the behaviour.
8484
@Test
85-
public void given_client_when_call_hotels_by_geocode_without_params_then_ok()
85+
public void givenClientWhenCallHotelsByGeocodeWithoutParamsThenOK()
8686
throws ResponseException {
8787

8888
//Given

src/test/java/com/amadeus/referenceData/locations/hotels/ByHotelsIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void teardown() {
5454
}
5555

5656
@Test
57-
public void given_client_when_call_hotels_by_hotels_with_params_then_ok()
57+
public void givenClientWhenCallHotelsByHotelsWithParamsThenOK()
5858
throws ResponseException {
5959

6060
//Given
@@ -78,7 +78,7 @@ public void given_client_when_call_hotels_by_hotels_with_params_then_ok()
7878

7979
//TODO Review with the team to upgrade the behaviour.
8080
@Test
81-
public void given_client_when_call_hotels_by_hotels_without_params_then_ok()
81+
public void givenClientWhenCallHotelsByHotelsWithoutParamsThenOK()
8282
throws ResponseException {
8383

8484
//Given

0 commit comments

Comments
 (0)