0

I am developing a complete reactive springboot application with webflux. While covering the unit test cases, I noticed an error, which functionally works absolutely correct. The following unit test case returns 400 Bad Format during execution

I am trying to achieve something of the similar pattern Controller Code( To be tested):

@GetMapping("/movieinfos")
    public Flux<MovieInfo> getAllMovieInfos(@RequestParam("fromDate") LocalDate fromDate){
        return moviesInfoService.getAllMovieInfos().log();
    }

Unit Test:

   @Test
    void getAllMovieInfos() {

        webTestClient
                .get()
                .uri(MOVIES_INFO_URL+"?fromDate=2022-08-09")
                .exchange()
                .expectStatus()
                .is2xxSuccessful();

    }

I have tried all variations of building the URI and passing the query parameter. Nothing seems to work. using date as string type is working though, how do we ensure LocalDate is compatible with webtestclient

0 Answers0