mardi 9 juin 2020

TestRestTemplate Post request with LocalDateTime

I have a post request that I would like to test with TestRestTemplate I know there is a problem with testing it with LocalDateTime. but there is anything I could do to test it?

@PostMapping
@CrossOrigin
public ResponseEntity<String> arrangeMeeting(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) @lombok.NonNull LocalDateTime From,@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) @lombok.NonNull LocalDateTime To, @lombok.NonNull String name) {
}

I tried something like that without much success:

HttpEntity<MultiValueMap<LocalDateTime, LocalDateTime>> request = 
new HttpEntity<MultiValueMap<LocalDateTime, LocalDateTime>>(map, headers);

ResponseEntity<String> responseEntity = this.testRestTemplate.exchange(URL, HttpMethod.POST, request, String.class);

Aucun commentaire:

Enregistrer un commentaire