Questions tagged [spring-webtestclient]

7 questions
3
votes
2 answers

How to extract values from a Spring WebTestClient JSON response for usage in subsequent requests?

With Spring Boot 2.4.2 I'm using the WebTestClient to invoke requests in my integration tests. This is the first request which gets a list of messages: webTestClient .get() .uri("/api/messages") .headers(http ->…
Robert Strauch
  • 12,055
  • 24
  • 120
  • 192
1
vote
1 answer

Spring webtestclient serializes dates to timestamps instead of dates

I am trying to check if the data I get back from the webtestclient is the same as what I expect. But the ZonedDateTime from the User data class is not just shown as a date but as a timestamp while I have applied Jackson to the webtestclient codecs.…
MrAndre
  • 811
  • 1
  • 10
  • 26
0
votes
1 answer

WebTestClient on HTTPS with SpringBootTest random_port

I have a rest service for which I needed to implement TLSv1.3 over HTTPS (HTTP is prohibited at my place for this app). Now the tests are failing because WebTestClient is making calls using http protocol over https. I know I could build…
0
votes
1 answer

WebTestClient assertThat json has only specific keys

I'm testing my endpoints like so: webTestClient.get().uri(BASE_URL). .exchange().expectStatus().isOk().expectBody() .jsonPath("$.name").isEqualTo("test1") .jsonPath("$.street").isEqualTo("test1") …
ch1ll
  • 419
  • 7
  • 20
0
votes
0 answers

WebTestClient post method is no value at JSON path

I'm testing for a controller but my test code is no value at JSON path. It's my test code. @Test @WithMockCustomUser void When_ValidBoardIsUsedToCreateBoard_Then_WillSuccess() { BoardDTO boardDTO =…
tail
  • 105
  • 1
  • 1
  • 9
0
votes
1 answer

How to test Reactor WebClient body response from a reactive endpoint that returns Mono>>?

I used open openapi-generator-maven-plugin from org.openapitools in my Spring Boot project with the reactive configuration enabled. One of my endpoint returns a List body response that is auto-generated as Mono>
-2
votes
1 answer

Spring boot - WebFlux - WebTestClient - convert response to responseEntity

I have a Reactive controller which returns: @ResponseBody @GetMapping("/data") public Mono> getData() { //service call which returns Mono dataMono Mono> responseEntityMono = dataMono …