### Question:
JpaEntityService implements EntityService { @Override public void delete(String id) { try { T reference = em.getReference(entityType, id); em.remove(reference); } catch (EntityNotFoundException e) { } } JpaEntityService(EntityManager em, ModelToJSONMapConverter<T> converter, Class<T> entityType); @Override StreamingOutput getAll(Integer from, Integer size, final String[] fieldsToRemove); @Override List<Map<String, Object>> getAll(); @Override Map<String, Object> get(String id); @Override String create(Map<String, Object> entity); @Override void create(String id, Map<String, Object> entity); @Override void update(String id, Map<String, Object> entity); @Override void delete(String id); @Override ListRequest listRequestInit(); @Override ListRequest listRequestNext(ListRequest previous);  }### Answer:
@Test public void delete() { JpaEntityService<Contributor> tested = new JpaEntityService<Contributor>(em, new ContributorConverter(), Contributor.class); try { em.getTransaction().begin(); String id1 = "aaa"; String val1 = "DDDDFGHDFHD"; Contributor c1 = createEntity(id1, val1); em.persist(c1); String id2 = "bbbbbb"; String val2 = "fgdsafgdsafgsdf"; Contributor c2 = createEntity(id2, val2); em.persist(c2); em.getTransaction().commit(); em.getTransaction().begin(); Assert.assertNotNull(em.find(Contributor.class, id1)); Assert.assertNotNull(em.find(Contributor.class, id2)); tested.delete(id1); em.getTransaction().commit(); em.getTransaction().begin(); Assert.assertNull(em.find(Contributor.class, id1)); Assert.assertNotNull(em.find(Contributor.class, id2)); em.getTransaction().commit(); em.getTransaction().begin(); tested.delete("unknown"); if (em.getTransaction().getRollbackOnly()) { em.getTransaction().rollback(); } else { em.getTransaction().commit(); } } catch (Exception ex) { ex.printStackTrace(); em.getTransaction().rollback(); Assert.fail("Exception during testPersistence"); } }