users@jersey.java.net

[Jersey] Mocking objects for Jersey unit tests

From: matthew huckaby <matthew.huckaby_at_gmail.com>
Date: Wed, 12 Oct 2011 08:41:24 -0500

Can anyone share an example as to how to mock fields on resources during a
Jersey unit test using Grizzly web container?
The problem is basically that because Jersey instantiates the resource to
handle the REST request - any dependencies inside the
resource class are null.

In a non-test runtime I am using Spring coupled with the
com.sun.jersey.spi.spring.container.servlet.SpringServlet to wire beans etc.

Thank you,
Matthew Huckaby