Код: Выделить всё
.andExpect(jsonPath("$.error.message")
.value(containsString("message")))
Код: Выделить всё
webClient.post().uri("/test")
.contentType(MediaType.APPLICATION_JSON)
.body(Mono.just(MyRequest), MyRequest.class)
.exchange()
.expectStatus().isBadRequest()
.expectBody()
.jsonPath("$.message").isEqualTo("message")
Это можно сделать, извлекая getBodyAsString () из WebTestClient.BodyContentSpec, но это выглядит не очень хорошо.
Подробнее здесь: https://stackoverflow.com/questions/491 ... sub-string
Мобильная версия