> -----Original Message-----
> From: Nayan Hajratwala [mailto:[email protected]]
> Sent: Wednesday, December 23, 2009 11:10 AM
> To: [email protected]
> Subject: Unit Tests for CXF JSON services
>
> Folks,
>
> I am trying (without much success) to write a unit test against a CXF
> service. Note that by Unit Test, I mean no starting up a "dummy" web
> server, no network access, etc. I will be using mocks for these parts.
I had asked about related issues a few days ago, with a subject line of
"Practical to write unit tests that can simulate the container and
verify XML/JSON data?". I haven't fully explored the answer, but I
think it was a reasonable solution.
>
> Essentially what I want to do is this:
>
> 1) Set up a JSON request, for simplicity:
>
> { "userId":1 }
>
> 2) Invoke the CXF service with that request to:
>
> /services/getUser
>
> During this step, i'll be injecting mocks into the service, so it will
> always return "Joe Schmoe"
>
>
> 3) Assert that the response comes back in the JSON format of:
>
> { getUserResponse: { "firstName":"Joe", "lastName":"Schmoe" } }
>
>
> My problem is that outside of a deployed/running web instance, i'm not
> sure how to get step 2 to take in JSON and return JSON.
>
> Suggestions?
>
> ---
> Nayan Hajratwala
> http://agileshrugged.com
> http://twitter.com/nhajratw
> 734.658.6032