users@jersey.java.net

How to test a REST client Jersey ?

From: Anthony Dahanne <anthony.dahanne_at_gmail.com>
Date: Tue, 15 Jun 2010 11:17:03 -0400

Hello !
I'm using Jersey to consume a REST service in JSON.
I've able to successfully consume the service (using only gor now) . but
now, as I'm starting to unit test this getService(int resourceId) method, I
realize that I don't know how to write this test !
What I would like is to check that my request is correct, meaning, conform
to what the REST service is expecting.
So , for example, my unit test would :
*create an instance of my implentation class
*call the getService(int resourceId)
*compare the generated request to what I expected to be sent

I've seen that a Test framework exists for Jersey server side (JesrseyTest)

Is there something similar for the client side, so that I can unit test my
client side API without consuming the real service ?

Thank you for your answers !
Anthony