Hi Pavel,
I'm not sure why I didn't receive your reply iny inbox but I saw it on the
archive.
I took look at the source also looking for a hacky workaround but pretty
much all the variables are final down to the web application impl, so
there's no good place to provide a fresh set of resources.
It definitely seems best solvable by moving the test container creation to
the setUp method, like you mentioned.
I've opened up a Jira improvement request and will post a sample test case
within the next day. (Jersey-1279)
Thanks!
Tim
On Tuesday, June 26, 2012, Timothy Rodriguez <timothy.rodriguez_at_gmail.com>
wrote:
> Hi all,
>
> I'm currently using the JerseyTest framework to test some of my
> Resources but I am having issues clearing the state of the resources
> between tests. I want each of the tests to be fully separable, so I
> want the application to have fresh instances of all its resources
> between tests.
>
> It looks like JerseyTest doesn't do that by default, so I opted for
> manually invoking the tearDown and setUp methods in my @Before method
> to manually reset the container. However, it looks like this does not
> fully reset the container as the stop method on the WebApplicationImpl
> does not set the isInitiated flag to false--causing the same instances
> of the resources to be used on startup.
>
> What is the best method for ensuring tests are fully separable? Is
> there a way to force a reinitiaion in my tests oe is there another way
> I should be going about this?
>
> Thanks,
>
> Tim
>