Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure test Jersey test client uses Dropwizard's ObjectMapper #2277

Merged
merged 1 commit into from Feb 19, 2018

Conversation

arteam
Copy link
Member

@arteam arteam commented Feb 19, 2018

Problem:

Currently the Jersey client produced by DropwizardAppRule uses a simple Jackson's ObjectMapper. This could be an issue when a serialized/deserialized entity requires additional modules (Java 8
Optional, DateTime, ParamaterNames module etc...), which are
added automatically in Dropwizard's ÒbjectMapper and used for the server side.

Solution:

Produce a client with a Jackson binder which uses the ObjectMapper instance from the test environment.

Result:

Less surprises for users and discrepancies between the client and server JSON serialization.

Currently the Jersey client produced by `DropwizardAppRule` uses
a simple Jackson's ObjectMapper. This could be an issue when
a serialized/deserialized entity requires additional modules (Java 8
`Optional`, `DateTime`, `ParamaterNames` module etc...), which are
added automatically in Dropwizard's `ÒbjectMapper` and used for the
server side. A fix is too prodouce a client with a Jackson binder
which uses the `ObjectMapper` instance from the test environment.
@jplock jplock added this to the 1.3.0 milestone Feb 19, 2018
@jplock jplock added the bug label Feb 19, 2018
@jplock jplock merged commit 4acf533 into master Feb 19, 2018
@jplock jplock deleted the test-rule-objectmapper branch February 19, 2018 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants