title: Test DeltaSpike Repositories cannot inject EntityManager
body: <p>I am trying to run a simple test for DeltaSpike repository. However, I cannot get the Entity Manager injected. I am using producer which is located and test sources:</p>
  
  <pre><code>@ApplicationScoped
  public class EntityManagerProducer {
  
      @Produces
      public EntityManager getEntityManager() {
          return Persistence
            .createEntityManagerFactory("primary-test")
            .createEntityManager();
      }
  }
  </code></pre>
  
  <p>In META-INF folder under test resources I have a persistence.xml file with primary-test persistence unit defined:</p>
  
  <pre><code>&lt;persistence version="2.0"
           xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
      &lt;persistence-unit name="primary-test" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;properties&gt;
              &lt;!-- Configuring JDBC properties --&gt;
              &lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/&gt;
              &lt;property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/&gt;
  
              &lt;!-- Hibernate properties --&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt;
              &lt;property name="hibernate.format_sql" value="false"/&gt;
              &lt;property name="hibernate.show_sql" value="true"/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>In very simple Unit I am trying to inject Entity Manager:</p>
  
  <pre><code>@RunWith(CdiTestRunner.class)
  public class UserRepositoryTest {
  
      @Inject
      private EntityManager entityManager;
  
      @Test
      public void shouldReturnEmptyListWhenDBIsEmpty() {
          // dummy test here
      }
  }
  </code></pre>
  
  <p>However, when I am running it I am getting the exception:</p>
  
  <pre><code> WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject private com.repository.UserRepositoryTest.entityManager]
  </code></pre>
  
  <p>My pom.xml has dependencies to Apache DeltaSpike Test Module and Weld:</p>
  
  <pre><code>&lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;deltaspike.version&gt;1.8.2&lt;/deltaspike.version&gt;
    &lt;weld.version&gt;1.1.10.Final&lt;/weld.version&gt;
  &lt;/properties&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
    &lt;artifactId&gt;deltaspike-test-control-module-api&lt;/artifactId&gt;
    &lt;version&gt;${deltaspike.version}&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
    &lt;artifactId&gt;deltaspike-test-control-module-impl&lt;/artifactId&gt;
    &lt;version&gt;${deltaspike.version}&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.deltaspike.cdictrl&lt;/groupId&gt;
    &lt;artifactId&gt;deltaspike-cdictrl-weld&lt;/artifactId&gt;
    &lt;version&gt;${deltaspike.version}&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;org.jboss.weld.se&lt;/groupId&gt;
    &lt;artifactId&gt;weld-se-core&lt;/artifactId&gt;
    &lt;version&gt;${weld.version}&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Any ideas why Entity Manager cannot be injected? I do not want to use Arquillian.</p>
  
  <p>EDIT:
  Current pom.xml:</p>
  
  <pre><code>&lt;groupId&gt;com.us&lt;/groupId&gt;
  &lt;artifactId&gt;deltaspike-samples&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;name&gt;DeltaSpike samples&lt;/name&gt;
  
  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;deltaspike.version&gt;1.8.1&lt;/deltaspike.version&gt;
    &lt;weld.version&gt;3.0.4.Final&lt;/weld.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencyManagement&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.deltaspike.distribution&lt;/groupId&gt;
        &lt;artifactId&gt;distributions-bom&lt;/artifactId&gt;
        &lt;version&gt;${deltaspike.version}&lt;/version&gt;
        &lt;type&gt;pom&lt;/type&gt;
        &lt;scope&gt;import&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.wildfly.bom&lt;/groupId&gt;
        &lt;artifactId&gt;jboss-javaee-7.0-with-hibernate&lt;/artifactId&gt;
        &lt;version&gt;8.2.2.Final&lt;/version&gt;
        &lt;type&gt;pom&lt;/type&gt;
        &lt;scope&gt;import&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax&lt;/groupId&gt;
      &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
      &lt;version&gt;7.0&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.core&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-core-api&lt;/artifactId&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.core&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-core-impl&lt;/artifactId&gt;
      &lt;scope&gt;runtime&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-data-module-api&lt;/artifactId&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-data-module-impl&lt;/artifactId&gt;
      &lt;scope&gt;runtime&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;!--Test dependencies--&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.12&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-test-control-module-api&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.modules&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-test-control-module-impl&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.cdictrl&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-cdictrl-api&lt;/artifactId&gt;
      &lt;version&gt;${deltaspike.version}&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.deltaspike.cdictrl&lt;/groupId&gt;
      &lt;artifactId&gt;deltaspike-cdictrl-weld&lt;/artifactId&gt;
      &lt;version&gt;${deltaspike.version}&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;javax.enterprise&lt;/groupId&gt;
      &lt;artifactId&gt;cdi-api&lt;/artifactId&gt;
      &lt;version&gt;2.0&lt;/version&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.jboss.weld.se&lt;/groupId&gt;
      &lt;artifactId&gt;weld-se-shaded&lt;/artifactId&gt;
      &lt;version&gt;3.0.4.Final&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.jboss.spec.javax.annotation&lt;/groupId&gt;
      &lt;artifactId&gt;jboss-annotations-api_1.2_spec&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  </code></pre>