### Question:
JPAContext { public EntityManager getEntityManager() { if (entityManager == null) { entityManager = config.getEntityManagerProvider().getEntityManager(); if (readOnly) { entityManager.setProperty("readOnly", readOnly); } } return entityManager; } JPAContext(JPAConfig jpaConfig, boolean readOnly); EntityManager getEntityManager(); void close(); void beginTxn(); void closeTxn(boolean rollback); boolean isTxnOpen(); boolean isReadOnly();  }### Answer:
@Test public void shouldGetEntityManager() { assertEquals(context.getEntityManager(), entityManager); }
@Test public void shouldGetSameEntityManagerSecondTime() { context.getEntityManager(); context.getEntityManager(); verify(emf, times(1)).createEntityManager(); }