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".
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"?
1 of 1 people found this helpful
if you are using arquillian 1.1.4.Final, could you retry with 1.1.3.Final?
Your test should then fail as expected.
Yes, it fails when i run it with 1.1.3.Final. Thanks!
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
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.
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.