jojo____
jojo____

Reputation: 257

JUnit Testing with bean injection

I am trying to test my web application using JUnit. I saw that there is cdi-unit which seems pretty nice or Arquillian with JBoss (I am on Seam3, JBoss 7.1.3) but I can't make it work.

As soon as I try to inject a bean (and I need to inject multiple beans for my tests), it isn't working. I get "unsatisfied injection for type[...] with qualifiers [@default] at injection point".

Especially for the EntityManager which I need to inject. Is there some easy plugin I can add to my pom file in order to get this working ?

Thanks !

Upvotes: 0

Views: 501

Answers (1)

chkal
chkal

Reputation: 5668

You should have a look at the DeltaSpike Test Control module. This will start an embedded CDI container in your test. It is really simple to set up.

Have a look at the module documentation here:

http://deltaspike.apache.org/documentation/test-control.html

Upvotes: 2

Related Questions