bastion-dev / Bastion

Java test library for HTTP APIs
http://bastion.rocks
GNU General Public License v3.0
13 stars 8 forks source link

#21: Added JsonRequest and JsonResponseAssertions #fromModel() utility methods. #75

Closed FrelliBB closed 7 years ago

FrelliBB commented 7 years ago

Related issue: https://github.com/bastion-dev/Bastion/issues/21

FrelliBB commented 7 years ago

There is a small issue due to the fact that the ObjectMapper we are using for serialization is not externally configurable (yet). If we use JsonResponseAssertions#fromModel and the model object contains some null fields, those fields are serialized into JSON as null.

This could be fixed by using @JsonInclude(Include.NON_NULL) on the passed models, but we should ideally allow the mapper to be configured externally and then it can be fixed by using objectMapper.setSerializationInclusion(Include.NON_NULL);.

KPull commented 7 years ago

@FrelliBB, with regards to a configurable ObjectMapper: I fully agree with this. Having said that, this issue should not stop us from merging this pull request since exposing functionality for configuring the ObjectMapper can be tackled separately (and won't really conflict with the changes here).

FrelliBB commented 7 years ago

Changes applied @KPull