-
1. Re: Injecting EJB into tests
casta_oh May 20, 2014 4:02 AM (in response to besolov)Hello Roman.
I suppose that you have well configured arquillian.
You could try with CDI. This will let you inject the @Stateless with the annotation @Inject. You need the file beans.xml to inject with CDI.
Your question: If I add "beans.xml" it works fine, but the test passes, even if I delete an annotation @Stateless from my EJB. I think it happens with JUNIT with Arquillian. When something goes bad with the injection, the test doesn`t work but the test results as "OK".
Regards.
-
2. Re: Injecting EJB into tests
besolov May 20, 2014 8:52 AM (in response to casta_oh)Thanks for the answer! It is really strange that the tests pass, when there are problems with the injection. Is it arquillian bug or it's "by design"?
-
3. Re: Injecting EJB into tests
robert.panzer May 20, 2014 4:29 PM (in response to besolov)1 of 1 people found this helpfulHi Roman,
if you are using arquillian 1.1.4.Final, could you retry with 1.1.3.Final?
Your test should then fail as expected.
-
4. Re: Injecting EJB into tests
besolov May 21, 2014 7:04 AM (in response to robert.panzer)Hi, Robert!
Yes, it fails when i run it with 1.1.3.Final. Thanks!
-
5. Re: Injecting EJB into tests
kpiwko May 21, 2014 8:33 AM (in response to besolov)Hi guys,
would any of you be able to provide a complete project that we could use to debug the behavior? There were not many changes in between 1.1.3.Final and 1.1.4.Final, to me it seems most likely as a regression delivered in https://github.com/arquillian/arquillian-core/commit/c5c73f0fb89114fb9144625053fab139a6f4350c
Thanks,
Karel
-
6. Re: Injecting EJB into tests
robert.panzer May 21, 2014 12:03 PM (in response to kpiwko)Hi Karel,
I filed ARQ-1758 containing a screenshot of the debugger at the position where IMO something is going wrong.
ARQ-1773 seems to have a test-project.
If that does not work I could prepare one next week when I am back from vacation.
For me the error appears when I do not add a class to the test archive the test class depends on. Instead of getting a NoClassDefFoundError as expected the test passes.
kind regards
Robert
-
7. Re: Injecting EJB into tests
arnoldjohansson May 22, 2014 9:03 AM (in response to besolov)I'm not a 100% about the current status of the Arquillian project, but eariler it didn't support @EJB injected EJBs (apart from singleton EJBs) by design. Instead it focused on injection of CDI-beans (with @Inject or by beans.xml as you indicate). By your problem description, it seems to still be the case.
-
8. Re: Injecting EJB into tests
besolov May 24, 2014 12:57 PM (in response to kpiwko)Karel, I created project on GitHub, demonstrating this bug: besolov/arquillian-regression-bug · GitHub.