After my previous post I thought that there were no more surprises and I would be able to document an already existing endpoint that I had written in the past. How wrong I was. I updated my example to be similar with that endpoint so that I could explain what happened.

The first difference is that the endpoint returns a list of greetings:

The second difference is that spring is used instead of spring-boot and the application is deployed as a war file in tomcat. The important project files are listed below:

web.xml:

applicationContext.xml:

The third difference is that endpoint is tested with jersey api client:

The first attempt to update the test class to use spring-restdocs and rest-assured went well until I got to the point of documenting response fields and I noticed that the service is returning:

instead of the expected:

After spending some time and using a lot of #[email protected]&%*! I found that in web.xml jersey is configured to use jackson:

The corresponding code from jersey test class is:

where I missed to add jackson and jaxb was used instead. The fix was simple:

and the response was the expected one:

The final test class looks like:

If jersey api client is used to test the endpoint, also the client needs to be configured to use jackson:

After making these small changes, I was finally able to document a production endpoint.

Your thoughts are welcome

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Help me to improve your experience on this site!

Rate your overall experience:
How was your experience in few words? What did you expect, what you actually found?
Type above words: