mardi 5 avril 2016

Is there a convenient test library for `MockHttpServletRequest` and `MockHttpServletResponse`?

I am used to test my code using the JAX RS classes Client, WebTarget, Response, etc. These are quite convenient, especially because certain methods for REST APIs are already provided, and JSON integration can be done using plugins.

I currently test directly against a servlet, with the help of MockHttpServletRequest and MockHttpServletResponse, and face the issue that these tests are rather hard to write. There is no convenient way to transform objects from/into JSON, I have troubles using query arguments (parameters), the builder pattern does not use immutable objects, ...

Is there a convenient library making use (or is usable with) the mentioned classes? Are there other ways to test just a servlet (without starting a dedicated container like Jetty or Tomcat) while still using the JAX RS classes?

Aucun commentaire:

Enregistrer un commentaire