### Question:
ResourceHostDataService implements DataService<String, ResourceHostEntity> { @Override public synchronized void persist( final ResourceHostEntity item ) { EntityManager em = emf.createEntityManager(); try { em.getTransaction().begin(); em.persist( item ); em.flush(); em.getTransaction().commit(); } catch ( Exception e ) { LOG.error( e.toString(), e ); if ( em.getTransaction().isActive() ) { em.getTransaction().rollback(); } } finally { em.close(); } } ResourceHostDataService( EntityManagerFactory entityManagerFactory ); @Override synchronized ResourceHostEntity find( final String id ); @Override synchronized Collection<ResourceHostEntity> getAll(); @Override synchronized void persist( final ResourceHostEntity item ); @Override synchronized void remove( final String id ); @Override synchronized void update( ResourceHostEntity item );  }### Answer:
@Test public void testPersist() throws Exception { service.persist( item ); verifyCommit(); throwException(); service.persist( item ); verifyRollback(); }