Моя цель - проверить (сбой) против запроса, который выглядит следующим образом: < /p> [code]{ "title": "some title", "foos": [null] } < /code> У меня есть этот простой код: < /p> import jakarta.validation.Valid; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController;
< /code> I can confirm this is som how working, since out of my 5 test cases, 4 are good (failing). 1- GOOD: curl --location 'http://localhost:8080/question' \ --header 'Content-Type: application/json' \ --data '{ "title": "some title" }' < /code> 2- GOOD: curl --location 'http://localhost:8080/question' \ --header 'Content-Type: application/json' \ --data '{ "title": "some title", "foos": null }' < /code> 3- GOOD: curl --location 'http://localhost:8080/question' \ --header 'Content-Type: application/json' \ --data '{ "title": "some title", "foos": [] }' < /code> 4- GOOD: curl --location 'http://localhost:8080/question' \ --header 'Content-Type: application/json' \ --data '{ "title": "some title", "foos": [{}] }' < /code> However, I would expect this to also fail, but it does not. curl --location 'http://localhost:8080/question' \ --header 'Content-Type: application/json' \ --data '{ "title": "some title", "foos": [null] }' < /code> May I ask how can I check against [null][/code]?