/** Test removing. */ public void testRemove() { final EntityManager em = TestHelper.getEntityManager(); final EntityTransaction tx = TestHelper.getEntityTransaction(); final Phase entity = getEntity(); tx.begin(); em.remove(em.getReference(Phase.class, entity.getId())); tx.commit(); final Set<Phase> items = getEntities("select e from Phase e"); assertTrue("There should be no entities after removing", items.isEmpty()); }
/** * Persists entity instance to the database before each test case. * * @throws Exception to jUnit */ protected void setUp() throws Exception { super.setUp(); // always call super method TestHelper.clearTables(); // clear predefinded phases persistEntity( true); // pointed true to indicate that all foreign entities are to be stored as well }