Hi James,
I am skeptical of the value of using Mocking techniques for testing,
plus i am not all that familiar with specifics of say EasyMock.
The approach we have encouraged is to utilize an embedded solution
like Grizzly and then the unit tests become more like functional tests.
However, currently in Jersey it is hard to override Jersey/JAX-RS-
related injected dependencies unless you directly instantiate the
class you want to test and perform the injection yourself, which is
easier if you are using constructor injection, but becomes harder if
another DI framework is utilized.
If you can explain what you want to do with code i might be able to
help more. Also if there are other developers interested in using
mocking and have more experience maybe we can work together to come up
with a solution?
Paul.
On May 23, 2010, at 12:53 AM, James Russo wrote:
> Hello,
>
> I'm looking to test some Jersey Resources which also have some
> @Autowired dependencies. I'd like to use the Jersey Test framework
> and something like EasyMock. However in my trying to get this to
> work I'm not sure how it is possibles since one context will belong
> to Grizzly and one context will belong to the unit test being run? I
> need access to the mock objects in the unit test to define the order
> of methods and return data, and then the same mock object in the
> resource object so it can call those methods?
>
> Is this even possible? Seem like I would need to both use something
> like SpringJUnit4ClassRunning as well as passing the context to the
> WebAppDescriptor in JerseyTest class.
>
> Thanks,
>
> -jr
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>