weld/weld-testing

Question: does it work with newest CDI and Weld?

sajanssens opened this issue · 3 comments

I tried to make weld-testing work with most recent versions of CDI and Weld, i.e. jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1 and org.jboss.weld.se:weld-se-core:5.0.1.Final.

It doesn't seem to work with both Java 11 or 17. I tried the SimpleTest example and I got:

org.jboss.weld.exceptions.IllegalArgumentException: WELD-001408: Unsatisfied dependencies for type Foo with qualifiers @Default at injection point [BackedAnnotatedField] @Inject com.example.dao.SimpleTest.foo

I've read that you need Junit5 and Java 11, but what are the supported Weld and CDI versions?

Hello,

as the README states:

Version 4.x of this extension supports Weld 5.0 (CDI 4.0) along with jakarta namespace

Project has dependencies on CDI 4 (pom.xml) and Weld 5 (pom.xml). Note that the fact that Weld version isn't newest doesn't mean you cannot declare your own newer, in fact you should.

Furthermore, when you checkout the main branch and do mvn clean install, you will run tests (JUnit 5 included) with CDI 4/Weld 5. As for JDKs, CI setup runs on JDK 11 and 17 and runs just fine.

You can take a look at the JUnit 5 tests that are here for some inspiration - https://github.com/weld/weld-testing/tree/master/junit5/src/test/java/org/jboss/weld/junit5
Or you can point me to your code and I can try to spot what's the issue. Either way, this extension should definitely work with CDI 4 and Weld 5 :)

Hi Matej,

Thanks for your swift reply. I'm sorry I didn't see that part of the readme myself.

Indeed, when I write a test in a new project, I works like a charm. Thanks to this I know better where to look for the root cause now. Thanks.

@sajanssens I will close this issue now, but if you are having issues troubleshooting that failure, don't hesitate to come back and ask more questions!