Skip to content

Commit 47c0057

Browse files
feat(json): added another jsonpath example
1 parent 6be6671 commit 47c0057

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/java/de/claudioaltamura/java/restassured/JsonPathTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ void shouldFindAllStarshipWithSpecificRating() {
1919
assertThat(starshipWithSpecificRating).isNotEmpty().hasSize(4);
2020
}
2121

22+
@Test
23+
void shouldResponseAllFilmsAnd200() {
24+
var films =
25+
get("http://swapi.dev/api/films/?format=json").then().statusCode(200).extract().jsonPath();
26+
assertThat(films.getList("results")).hasSize(6);
27+
assertThat(films.getList("results.title"))
28+
.contains(
29+
"A New Hope",
30+
"The Empire Strikes Back",
31+
"Return of the Jedi",
32+
"The Phantom Menace",
33+
"Attack of the Clones",
34+
"Revenge of the Sith");
35+
}
36+
2237
/**
2338
* @Test void sumUpNamesLengthWithJsonPath() { String response =
2439
* get("http://restcountries.eu/rest/v1/").asString();
@@ -27,4 +42,5 @@ void shouldFindAllStarshipWithSpecificRating() {
2742
*
2843
* <p>assertThat(sumNames).isEqualTo(2490); }
2944
*/
45+
3046
}

0 commit comments

Comments
 (0)