Skip to content

Commit c942c8d

Browse files
committed
Fix expectations in MockMvc Kotlin documentation
Closes gh-28301
1 parent 1201af2 commit c942c8d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/docs/asciidoc/testing.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7367,7 +7367,7 @@ no other expectations will be asserted.
73677367
import org.springframework.test.web.servlet.get
73687368
73697369
mockMvc.get("/accounts/1").andExpect {
7370-
status().isOk()
7370+
status { isOk() }
73717371
}
73727372
----
73737373

@@ -7415,7 +7415,7 @@ The following test asserts that binding or validation failed:
74157415
import org.springframework.test.web.servlet.post
74167416
74177417
mockMvc.post("/persons").andExpect {
7418-
status().isOk()
7418+
status { isOk() }
74197419
model {
74207420
attributeHasErrors("person")
74217421
}
@@ -7443,7 +7443,7 @@ request. You can do so as follows, where `print()` is a static import from
74437443
mockMvc.post("/persons").andDo {
74447444
print()
74457445
}.andExpect {
7446-
status().isOk()
7446+
status { isOk() }
74477447
model {
74487448
attributeHasErrors("person")
74497449
}
@@ -7473,7 +7473,7 @@ other expectations, as the following example shows:
74737473
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
74747474
.Kotlin
74757475
----
7476-
var mvcResult = mockMvc.post("/persons").andExpect { status().isOk() }.andReturn()
7476+
var mvcResult = mockMvc.post("/persons").andExpect { status { isOk() } }.andReturn()
74777477
// ...
74787478
----
74797479

@@ -7593,7 +7593,7 @@ or reactive type such as Reactor `Mono`:
75937593
@Test
75947594
fun test() {
75957595
var mvcResult = mockMvc.get("/path").andExpect {
7596-
status().isOk() // <1>
7596+
status { isOk() } // <1>
75977597
request { asyncStarted() } // <2>
75987598
// TODO Remove unused generic parameter
75997599
request { asyncResult<Nothing>("body") } // <3>
@@ -7602,7 +7602,7 @@ or reactive type such as Reactor `Mono`:
76027602
76037603
mockMvc.perform(asyncDispatch(mvcResult)) // <4>
76047604
.andExpect {
7605-
status().isOk() // <5>
7605+
status { isOk() } // <5>
76067606
content().string("body")
76077607
}
76087608
}

0 commit comments

Comments
 (0)