/** * Test to check we can add a simple candidate to the database and then retrieve it back. Simple * candidate means it has no relationships. * * @throws DaoStoreException */ @Test public void testPersit() throws DaoStoreException { CandidateDaoJpa dao = new CandidateDaoJpa(); dao.setEntityManager(this.em); Collection<Candidate> found = dao.findAll(); int initial = found.size(); Candidate candidate = new Candidate(); candidate.setName("test candidate"); candidate.setAddress("test address"); candidate.setEmail("*****@*****.**"); dao.persist(candidate); found = dao.findAll(); int after = found.size(); assertEquals("candidate size should have increased", initial + 1, after); }