Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
1.0.3
-
None
-
None
Description
I have a test that is @RunWith(CdiTestRunner.class), is @Injecting an
@ApplicationScopedBean1 which itself @Injects another @ApplicationScopedBean2 and then I have another @Inject directly in the test class which also @Injects the @ApplicationScopedBean2.
The CDI implementation used is Weld-SE
ApplicationScopedBean2 contains a cache.
What's happeneing is, that ApplicationScopedBean2 gets created twice, once for ApplicationScopedBean1 and once for the test class.
So when I then call ApplicationScopedBean2.invalidateMyCache() in the test and then ask ApplicationScopedBean1.getSomethingFromYourApplicationScopedBean2sCache, then because its two different beans I still get some cached values. Of course all calls are done within the same test method!
Deployed on a server the whole thing works as expected, only one bean of type ApplicationScopedBean2 is being created.
But the whole purpose of having DeltaSpike is to be able to test stuff exactly as it would be on the server, right?
So I'm not sure, if this is a Bug, a known limitation (couldn't find anything about that) or a configuration problem with my test setup.