Java SE: Unit Testing CDI with JUnit and JBoss Weld SE

You may also like...

  • Paolo

    This tutorial does not work….
    I have created a fresh maven project, copied the code from the tutorial, and used only the copy/pasted dependencies from the pom file fragment provided and still receive the following error….

    testCDI(LogTest): WELD-001308: Unable to resolve any beans for Type: class LogTest; Qualifiers: [@javax.enterprise.inject.Any()]

    • Hey Paolo, thanks for trying this tutorial. It sounds like CDI is not enabled. You should include the beans.xml file in your test project. This file should be located at src/test/resources/META-INF/beans.xml. The resources folder must be on your classpath. I’ve added the project structure, compare this to your project. Or you can download the example code to compare. If you still experiencing issues let me know. Kind regards.

  • Kolya Yanchiy

    Thanks a lot)))