After too much Internet searching, I was unable to find an easy
solution to repeated duplication in my Spring MockMVC tests of REST
controller endpoints. For years now, the endpoints we write have
typically sent or received JSON. This is what I mean:
All the repeated "APPLICATION_JSON_UTF8"s, in every controller test!
If there is an existing Spring testing solution, I'd love to hear about
it. Rather than wait, I wrote up a small extension of
@WebMvcTest to default these values.
First, an annotation for Spring to use in setting up…