Hello,
it is not possible, jersey test framework always needs to start jersey
and if you define just this class as only resource, it won't start
because there is no root resource present.
What you can do is create something like ResTestResource, which could
look like:
@Path("/")
public class ResTestResource extends Res {
public ResTestResource() {
super("injected value");
}
}
and run your test(s) against it..
Pavel
On 04/07/2011 04:29 PM, Mark Engel wrote:
> How is it possible to unit test just one resource at a time?
>
> For example I have this resource
>
> class Res {
> private final String injected;
> public Res(String injected) { this.injected = injected; }
> @GET public String get() { return injected; }
> }
>
> and want to unit test this resource with a custom stub (configured via
> setUp()) against real http calls from Client.
> I would expect that if I only test one resource it would be in the
> root of the server.
>
> Is this possible with Jersey? I only found options to configure a
> whole package of resource.
>