diff --git a/integration-tests/resteasy-reactive-rest-client/src/test/java/io/quarkus/it/rest/client/BasicTest.java b/integration-tests/resteasy-reactive-rest-client/src/test/java/io/quarkus/it/rest/client/BasicTest.java index c4d622802fd5d..6b0b985d0cf3b 100644 --- a/integration-tests/resteasy-reactive-rest-client/src/test/java/io/quarkus/it/rest/client/BasicTest.java +++ b/integration-tests/resteasy-reactive-rest-client/src/test/java/io/quarkus/it/rest/client/BasicTest.java @@ -1,7 +1,12 @@ package io.quarkus.it.rest.client; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.equalTo; +import static java.util.stream.Collectors.counting; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.junit.jupiter.api.Test; @@ -15,21 +20,18 @@ public class BasicTest { @TestHTTPResource("/apples") String appleUrl; + @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void shouldWork() { - RestAssured.with().body(appleUrl).post("/call-client") + List results = RestAssured.with().body(appleUrl).post("/call-client") .then() .statusCode(200) .contentType("application/json") - .body("size()", is(9)) - .body("[0].cultivar", equalTo("cortland")) - .body("[1].cultivar", equalTo("cortland2")) - .body("[2].cultivar", equalTo("cortland3")) - .body("[3].cultivar", equalTo("cortland")) - .body("[4].cultivar", equalTo("cortland2")) - .body("[5].cultivar", equalTo("cortland3")) - .body("[6].cultivar", equalTo("cortland")) - .body("[7].cultivar", equalTo("cortland2")) - .body("[8].cultivar", equalTo("cortland3")); + .extract().body().jsonPath().getList(".", Map.class); + assertThat(results).hasSize(9).allSatisfy(m -> { + assertThat(m).containsOnlyKeys("cultivar"); + }); + Map valueByCount = results.stream().collect(Collectors.groupingBy(m -> m.get("cultivar"), counting())); + assertThat(valueByCount).containsOnly(entry("cortland", 3L), entry("cortland2", 3L), entry("cortland3", 3L)); } }