>>> Tis hard when classes need to be deployed e.g. like servlet, JAX-
>>> WS or EJB.
>
> I think one can still to TDD of resource classes but the focus is on
> the HTTP interface, which IMHO is not a bad thing since this is
> what matters most?
It depends. I personally think that testing a resource class via the
HTTP interface is a functional test, not a unit test. You don't test
the micro functionality of single methods, but rather the whole
interface in and out. There should be a way to run your code directly
without any HTTP stuff in between ...
> If you could extend from say a class JerseyUnitTest that helped you
> 'deploy' or 'mock up' just what you need and you could utilize the
> Jersey client API you might get reasonable rapid test driven
> development. Would that work for you?
Currently I'm also developing a Spring-based application. I've created
a class "SpringBasedTest" that sets up the dependency injection for
all sub classes, and this makes it pretty easy to implement tests.
This should be possible for Jersey too - JUnit has some hooks to
integrate into, e.g., the @RunWith annotation. This allows me to
simply call my methods directly, and it makes testing very straight
forward.
So, using the Jersey Client API is a great thing for end-to-end tests
of the functionality, but I'd rather have a simple way of directly
executing my code.
Regards,
Martin.