users@jersey.java.net

Re: [Jersey] Unit testing resources

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 23 Jun 2008 11:25:25 +0200

On Jun 23, 2008, at 11:20 AM, Martin Probst wrote:

> Hi all,
>
> I have a question about unit testing of resource classes. I have
> trouble setting up injection so that I can actually use the
> classes. E.g.:
>
> @Path("...")
> class FooResource {
> @Context UriInfo info;
> }
>
> Now I want to unit test this method - but how do I get the fields
> injected in my test harness?
>

You mean that the field "info" is null? Jersey should be setting that
field for you.

Are you using your own ComponentProvider for testing?

Paul.