From 7e4884fcfaf6a35b065bef0d77e567c512a246b2 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Thu, 8 Aug 2024 00:37:26 +0200 Subject: [PATCH] Add missing Kotlin example for expectAll() See gh-33341 --- .../modules/ROOT/pages/testing/webtestclient.adoc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/framework-docs/modules/ROOT/pages/testing/webtestclient.adoc b/framework-docs/modules/ROOT/pages/testing/webtestclient.adoc index f840531788ad..7f0fa031ef80 100644 --- a/framework-docs/modules/ROOT/pages/testing/webtestclient.adoc +++ b/framework-docs/modules/ROOT/pages/testing/webtestclient.adoc @@ -339,6 +339,19 @@ Java:: spec -> spec.expectHeader().contentType(MediaType.APPLICATION_JSON) ); ---- + +Kotlin:: ++ +[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] +---- + client.get().uri("/persons/1") + .accept(MediaType.APPLICATION_JSON) + .exchange() + .expectAll( + { spec -> spec.expectStatus().isOk() }, + { spec -> spec.expectHeader().contentType(MediaType.APPLICATION_JSON) } + ) +---- ====== You can then choose to decode the response body through one of the following: @@ -704,4 +717,3 @@ Kotlin:: .andExpect(model().attribute("string", "a string value")); ---- ====== -