users@jersey.java.net

[Jersey] Re: Jersey test framework

From: Yoryos <valotas_at_gmail.com>
Date: Thu, 7 Jul 2011 18:26:52 +0300

Just for reference,

after some research of the source code I found out that the in memory
TestContainer and the simple http one do not support the DI mechanism
defined within the given WebAppDescriptor as they only use the simple
AppDescriptor (I do not remember it's exact name) to create the
WebApplication.

Using grizzly2 as the TestContainer solved to problem.

On Tue, Jul 5, 2011 at 14:24, Yoryos <valotas_at_gmail.com> wrote:

> Hello,
> I'm trying to use the jersey test framework with guice but can't make it
> work. I've got two resource classes without any constructor dependency and
> one that needs an injection of a pojo to work. The project runs just fine
> but I would like to create some tests and so tried the to do so having a
> look at the guice-filter sample<http://download.java.net/maven/2/com/sun/jersey/samples/guicefilter-webapp/1.8/guicefilter-webapp-1.8-project.zip>.
> The test framework finds the resource classes (all 3 of them) but fails with
> the message:
>
> SEVERE: The following errors and warnings have been detected with resource
> and/or provider classes:
> SEVERE: Missing dependency for constructor public
> com.xxx.xxx.rest.rs.SimpleDomainResource(com.xxx.xxx.DomainService) at
> parameter index 0
>
> The SimpleDomainResource has a constructor marked with @Inject which
> expects as an argument the DomainService class.
>
> Any hints?
>
> Y.
>
>