Skip to content

Commit

Permalink
Add missing Kotlin example for expectAll()
Browse files Browse the repository at this point in the history
  • Loading branch information
pcvolkmer authored and snicoll committed Aug 8, 2024
1 parent 38a3d18 commit 7e4884f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion framework-docs/modules/ROOT/pages/testing/webtestclient.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -704,4 +717,3 @@ Kotlin::
.andExpect(model().attribute("string", "a string value"));
----
======

0 comments on commit 7e4884f

Please sign in to comment.