title: Why EntityManager is not injected?
body: <p>This is the class I'm trying to test:</p>
  
  <pre><code>@Stateless
  public class Finder {
    @PersistenceContext(unitName = "abc")
    EntityManager em;
    public String read(int i) {
      return this.em.find(Employee.class, i).getName();
    }
  }
  </code></pre>
  
  <p>This is the unit test:</p>
  
  <pre><code>public class FinderTest {
    @Test public void testReadingWorks() {
      Finder f = new Finder();
      String name = f.find(1);
      assert(name.length() &gt; 0);
    }
  }
  </code></pre>
  
  <p>The problem is that EntityManager is not injected, and is <code>NULL</code> during testing. What am I doing wrong?</p>
  
  <p>ps. Actually, I don't understand <strong>who</strong> exactly is going to inject EntityManager. The unit test is started by JUnit, outside of any container... Maybe I have to inject <code>em</code> manually in the test?</p>