title: How to initialize an EJB's EntityManager in a JUnit test?
body: <p>I'm trying to write JUnit tests for a stateless session bean that has an injected EntityManager:</p>
  
  <pre><code>@Stateless
  public class MyServiceBean implements MyService, ... {
  @PersistenceContext
      private EntityManager em;
      ....
  </code></pre>
  
  <p>Of course, without doing anything, em remains null in the flow of the test...</p>
  
  <p>The tests should run standalone (NOT in a Java EE container).</p>
  
  <p>How do I do that please? (simple solutions will be most appreciated :-)</p>