Skip to content

Commit 2d55ca2

Browse files
authored
Merge pull request #238 from amadeus4dev/add-assertions
Add missing assertions on integration tests
2 parents 96cf86f + a18ca47 commit 2d55ca2

23 files changed

+201
-57
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertEquals;
9+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
910

1011
import com.amadeus.Amadeus;
1112
import com.amadeus.Params;
1213
import com.amadeus.exceptions.ClientException;
1314
import com.amadeus.exceptions.ResponseException;
1415
import com.amadeus.resources.Destination;
1516
import com.github.tomakehurst.wiremock.WireMockServer;
17+
1618
import org.junit.jupiter.api.AfterEach;
1719
import org.junit.jupiter.api.BeforeEach;
1820
import org.junit.jupiter.api.Test;
@@ -71,7 +73,7 @@ public void givenClientWhenCallAirlineDestinationsWithMandatoryParamsThenOk()
7173
);
7274

7375
//Then
74-
then(result.length).isNotEqualTo(0);
76+
assertNotEquals(0, result.length);
7577
}
7678

7779
@Test
@@ -94,7 +96,7 @@ public void givenClientWhenCallAirlineDestinationsWithOptionalParamsThenOK()
9496
);
9597

9698
//Then
97-
then(result.length).isEqualTo(2);
99+
assertEquals(2, result.length);
98100
}
99101

100102
//TODO Review with the team to upgrade the behaviour.

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static com.github.tomakehurst.wiremock.client.WireMock.post;
55
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
66
import static org.assertj.core.api.BDDAssertions.then;
7+
import static org.junit.jupiter.api.Assertions.assertNotNull;
78

89
import com.amadeus.Amadeus;
910
import com.amadeus.exceptions.ResponseException;
@@ -100,7 +101,7 @@ public void givenClientWhenCallFlightOffersWithParamsThenOK()
100101
FlightOrder result = amadeus.booking.flightOrders.post(flightPricing, travelerArray);
101102

102103
//Then
103-
then(result).isNotNull();
104+
assertNotNull(result);
104105
}
105106

106107
private Traveler[] getTravelerData() {
@@ -161,7 +162,7 @@ public void givenClientWhenCallFlightOffersWithParamsAlternative2ThenOK()
161162
FlightOrder result = amadeus.booking.flightOrders.post(flightOffersSearches, travellers);
162163

163164
//Then
164-
then(result).isNotNull();
165+
assertNotNull(result);
165166
}
166167

167168
@Test
@@ -191,7 +192,7 @@ public void givenClientWhenCallFlightOffersWithParamsAlternative3ThenOK()
191192
FlightOrder result = amadeus.booking.flightOrders.post(flightOffersSearches[0], travellers);
192193

193194
//Then
194-
then(result).isNotNull();
195+
assertNotNull(result);
195196
}
196197

197198
@Test
@@ -211,7 +212,7 @@ public void givenClientWhenCallFlightOffersWithParamsAlternative4ThenOK()
211212
FlightOrder result = amadeus.booking.flightOrders.post(request);
212213

213214
//Then
214-
then(result).isNotNull();
215+
assertNotNull(result);
215216
}
216217

217218
private JsonObject getRequestFromResources(String jsonFile) throws IOException {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotNull;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.DiseaseReport;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -71,7 +72,7 @@ public void givenClientWhenCallTravelRestrictionsV2WithParamsThenOK()
7172
);
7273

7374
//Then
74-
then(result).isNotNull();
75+
assertNotNull(result);
7576
}
7677

7778
//TODO Review with the team to upgrade the behaviour.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.City;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -70,7 +71,7 @@ public void givenClientWhenCallCitySearchWithParamsThenOK()
7071
City[] result = amadeus.referenceData.locations.cities.get(params);
7172

7273
//Then
73-
then(result.length).isNotEqualTo(0);
74+
assertNotEquals(0, result.length);
7475
}
7576

7677
@Test

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
import static com.github.tomakehurst.wiremock.client.WireMock.get;
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
7-
import static org.assertj.core.api.BDDAssertions.then;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
9+
import static org.junit.jupiter.api.Assertions.assertNotNull;
10+
import static org.junit.jupiter.api.Assertions.assertTrue;
811

912
import com.amadeus.Amadeus;
1013
import com.amadeus.Params;
1114
import com.amadeus.exceptions.ResponseException;
1215
import com.amadeus.resources.Hotel;
1316
import com.amadeus.resources.HotelOfferSearch;
1417
import com.github.tomakehurst.wiremock.WireMockServer;
18+
1519
import java.io.IOException;
1620
import java.net.URLEncoder;
1721
import java.util.ArrayList;
1822
import java.util.List;
23+
1924
import org.junit.jupiter.api.AfterEach;
2025
import org.junit.jupiter.api.BeforeEach;
2126
import org.junit.jupiter.api.Test;
@@ -76,8 +81,8 @@ public void givenClientWhenCallHotelWithMandatoryParametersThenReturnsOK()
7681
Hotel[] result = amadeus.referenceData.locations.hotel.get(params);
7782

7883
//Then
79-
then(result).isNotNull();
80-
then(result.length).isGreaterThan(1);
84+
assertNotNull(result);
85+
assertTrue(result.length > 1);
8186
}
8287

8388
@Test
@@ -101,8 +106,8 @@ public void givenClientWhenCallHotelThenReturnsSingleHotelResponseOK()
101106
Hotel[] result = amadeus.referenceData.locations.hotel.get(params);
102107

103108
//Then
104-
then(result).isNotNull();
105-
then(result.length).isEqualTo(1);
109+
assertNotNull(result);
110+
assertEquals(1, result.length);
106111
}
107112

108113
@Test
@@ -126,8 +131,8 @@ public void givenClientWhenCallHotelThenReturnsMultipleHotelResponseOK()
126131
Hotel[] result = amadeus.referenceData.locations.hotel.get(params);
127132

128133
//Then
129-
then(result).isNotNull();
130-
then(result.length).isEqualTo(5);
134+
assertNotNull(result);
135+
assertEquals(5, result.length);
131136
}
132137

133138
@Test
@@ -153,8 +158,7 @@ public void givenClientWhenCallHotelWithAllParametersThenResponseOK()
153158
Hotel[] result = amadeus.referenceData.locations.hotel.get(params);
154159

155160
//Then
156-
then(result).isNotNull();
157-
then(result.length).isGreaterThan(1);
161+
assertTrue(result.length > 1);
158162
}
159163

160164
@Test
@@ -193,6 +197,6 @@ public void givenClientWhenCallHotelOffersSearchWithParamsThenOK()
193197
);
194198

195199
//Then
196-
then(result.length).isNotEqualTo(0);
200+
assertNotEquals(0, result.length);
197201
}
198202
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import static com.github.tomakehurst.wiremock.client.WireMock.get;
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
7-
import static org.assertj.core.api.BDDAssertions.then;
7+
import static org.junit.jupiter.api.Assertions.assertNotNull;
88

99
import com.amadeus.Amadeus;
1010
import com.amadeus.exceptions.ResponseException;
1111
import com.amadeus.resources.PointOfInterest;
1212
import com.github.tomakehurst.wiremock.WireMockServer;
13+
1314
import org.junit.jupiter.api.AfterEach;
1415
import org.junit.jupiter.api.BeforeEach;
1516
import org.junit.jupiter.api.Test;
@@ -67,7 +68,7 @@ public void givenClientWhenCallPointOfInterestByIdThenOK()
6768
PointOfInterest result = amadeus.referenceData.locations.pointOfInterest(id).get();
6869

6970
//Then
70-
then(result).isNotNull();
71+
assertNotNull(result);
7172
}
7273

7374
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.Hotel;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -71,7 +72,7 @@ public void givenClientWhenCallHotelsByCityWithParamsThenOK()
7172
Hotel[] result = amadeus.referenceData.locations.hotels.byCity.get(params);
7273

7374
//Then
74-
then(result.length).isNotEqualTo(0);
75+
assertNotEquals(0, result.length);
7576
}
7677

7778
//TODO Review with the team to upgrade the behaviour.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.Hotel;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -77,7 +78,7 @@ public void givenClientWhenCallHotelsByGeocodeWithParamsThenOK()
7778
.hotels.byGeocode.get(params);
7879

7980
//Then
80-
then(result.length).isNotEqualTo(0);
81+
assertNotEquals(0, result.length);
8182
}
8283

8384
//TODO Review with the team to upgrade the behaviour.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.Hotel;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -73,7 +74,7 @@ public void givenClientWhenCallHotelsByHotelsWithParamsThenOK()
7374
.hotels.byHotels.get(params);
7475

7576
//Then
76-
then(result.length).isNotEqualTo(0);
77+
assertNotEquals(0, result.length);
7778
}
7879

7980
//TODO Review with the team to upgrade the behaviour.

src/test/java/com/amadeus/referenceData/locations/pointsOfInterest/BySquareIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import static com.github.tomakehurst.wiremock.client.WireMock.post;
66
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
77
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
8-
import static org.assertj.core.api.BDDAssertions.then;
8+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99

1010
import com.amadeus.Amadeus;
1111
import com.amadeus.Params;
1212
import com.amadeus.exceptions.ClientException;
1313
import com.amadeus.exceptions.ResponseException;
1414
import com.amadeus.resources.PointOfInterest;
1515
import com.github.tomakehurst.wiremock.WireMockServer;
16+
1617
import org.junit.jupiter.api.AfterEach;
1718
import org.junit.jupiter.api.BeforeEach;
1819
import org.junit.jupiter.api.Test;
@@ -77,7 +78,7 @@ public void givenClientWhenCallPointsOfInterestBySquareWithParamsThenOK()
7778
.pointsOfInterest.bySquare.get(params);
7879

7980
//Then
80-
then(result.length).isNotEqualTo(0);
81+
assertNotEquals(0, result.length);
8182
}
8283

8384
//TODO Review with the team to upgrade the behaviour.

0 commit comments

Comments
 (0)