### Question:
JPAContainerFactory { public static <T> JPAContainer<T> make(Class<T> entityClass, EntityManager entityManager) { return makeWithEntityProvider(entityClass, new CachingMutableLocalEntityProvider<T>(entityClass, entityManager)); }  static JPAContainer<T> make(Class<T> entityClass,
            EntityManager entityManager); static JPAContainer<T> make(Class<T> entityClass,
            String persistenceUnitName); synchronized static EntityManager createEntityManagerForPersistenceUnit(
            String name); static JPAContainer<T> makeReadOnly(Class<T> entityClass,
            EntityManager entityManager); static JPAContainer<T> makeReadOnly(Class<T> entityClass,
            String persistenceUnitName); static JPAContainer<T> makeBatchable(Class<T> entityClass,
            EntityManager entityManager); static JPAContainer<T> makeBatchable(Class<T> entityClass,
            String persistenceUnitName); static JPAContainer<T> makeNonCached(Class<T> entityClass,
            EntityManager entityManager); static JPAContainer<T> makeNonCached(Class<T> entityClass,
            String persistenceUnitName); static JPAContainer<T> makeNonCachedReadOnly(
            Class<T> entityClass, EntityManager entityManager); static JPAContainer<T> makeNonCachedReadOnly(
            Class<T> entityClass, String persistenceUnitName); static JPAContainer<T> makeNonCachedReadOnlyJndi(
            Class<T> entityClass); static JPAContainer<T> makeNonCachedReadOnlyJndi(
            Class<T> entityClass, JndiAddresses jndiAddresses); static JPAContainer<T> makeNonCachedJndi(Class<T> entityClass); static JPAContainer<T> makeNonCachedJndi(Class<T> entityClass,
            JndiAddresses jndiAddresses); static JPAContainer<T> makeJndi(Class<T> entityClass); static JPAContainer<T> makeJndi(Class<T> entityClass,
            JndiAddresses jndiAddresses); static JPAContainer<T> makeBatchableJndi(Class<T> entityClass); static JPAContainer<T> makeBatchableJndi(Class<T> entityClass,
            JndiAddresses jndiAddresses);  }### Answer:
@Test public void testCreateJPAContainer() { JPAContainer<Person> c = JPAContainerFactory.make(Person.class, entityManager); assertNotNull(c); }
@Test public void testCreateJPAContainerHasCorrectEntityProvider() { JPAContainer<Person> c = JPAContainerFactory.make(Person.class, entityManager); assertEquals(CachingMutableLocalEntityProvider.class, c .getEntityProvider().getClass()); EntityManager entityManagerOfProvider = ((CachingMutableLocalEntityProvider<?>) c .getEntityProvider()).getEntityManager(); assertNotNull(entityManagerOfProvider); assertEquals(entityManager, entityManagerOfProvider); }
@Test public void testCreateJPAContainerUsingPersistenceUnitNameHasCorrectEntityProvider() { JPAContainer<Person> c = JPAContainerFactory.make(Person.class, "eclipselink-in-memory"); assertNotNull(c); assertEquals(CachingMutableLocalEntityProvider.class, c .getEntityProvider().getClass()); EntityManager entityManagerOfProvider = ((CachingMutableLocalEntityProvider<?>) c .getEntityProvider()).getEntityManager(); assertNotNull(entityManagerOfProvider); }
@Test public void testCreateJPAContainerUsingPersistenceUnitNameReusesEntityManagerFactory() { JPAContainer<Person> c = JPAContainerFactory.make(Person.class, "eclipselink-in-memory"); EntityManager em = ((CachingMutableLocalEntityProvider<?>) c .getEntityProvider()).getEntityManager(); JPAContainer<Skill> c2 = JPAContainerFactory.make(Skill.class, "eclipselink-in-memory"); EntityManager em2 = ((CachingMutableLocalEntityProvider<?>) c2 .getEntityProvider()).getEntityManager(); assertEquals(em.getEntityManagerFactory(), em2.getEntityManagerFactory()); }