Re: [rest-assured] Accessing the Jackson ObjectMapper to enable configuration

932 views
Skip to first unread message

Johan Haleby

unread,
Jul 25, 2012, 4:35:17 AM7/25/12
to rest-a...@googlegroups.com
Hi, 

Unfortunately there's no good way to do that. It's on the road map (you should be able to configure existing encoders/decoders and roll your own) but I can't make any promises on when it's implemented. Perhaps it could be possible to add more features to the EncoderConfig and DecoderConfig but I need to get started on it before I can know for sure. Are you interested in participating?

Regards,
/Johan

On Wed, Jul 25, 2012 at 10:02 AM, thehpi <the...@gmail.com> wrote:
Hi,

Short:

Is there a way to get a reference to the jackson ObjectMapper?

Long:

I'v built a REST web service based on Jersey. I'm using jackson to generate JSON. The jackson ObjectMapper has been configured to produce the required JSON output.
Now I want to use rest-assured as a client for integration testing. To get this working I need to configure the jackson ObjectMapper the same way as is done on the server.
But I can't find a way to access the ObjectMapper.

tx

Hans

thehpi

unread,
Jul 25, 2012, 4:54:31 AM7/25/12
to rest-a...@googlegroups.com
Oke, thanks for your quick reply. I would like to help a bit but I never used groovy so thats going to be a problem I guess.
I think you need to replace the (rest-assured) ObjectMapper enum class with e.g. a configurable ObjectMapperFactory or something like that.
This would enable the user to provide its own factory where he can configure the (jackson) ObjectMapper.
Optionally you could even make these classes discoverable using annotations.

thehpi

unread,
Jul 25, 2012, 6:50:08 AM7/25/12
to rest-a...@googlegroups.com
Hi,

I cloned the git repo and tried to run the tests. Without success. I'm getting

  java.lang.ClassNotFoundException: com.jayway.restassured.scalatra.CustomAuthExample

This class exists in the scalatra-webapp project but is somehow not accessible.

Can you describe the procedure to build and run the tests?

Hans

Johan Haleby

unread,
Jul 25, 2012, 7:10:20 AM7/25/12
to rest-a...@googlegroups.com
It requires maven2. I'm trying to get it working with Maven3 but I haven't been able to do so yet. The problem is, as always, lack of time. Since yesterday I don't think the trunk actually pass all tests (three tests fail) since I merged two pull requests. I'm working on a fix.

Regards,
/Johan

thehpi

unread,
Jul 25, 2012, 10:00:53 AM7/25/12
to rest-a...@googlegroups.com
Hi,

I sent you a pull request to enable configuring the jackson ObjectMapper.

tx

Hans
Reply all
Reply to author
Forward
0 new messages