@Test @Transactional public void retrieveConference() { log.debug("enter test retrieveConference@"); Conference newConf = newConference(); newConf.setSlug("jud-2014"); Long id = conferenceDao.save(newConf); assertTrue(id != null); log.debug("id @=" + id); Conference conference = conferenceDao.findById(id); assertTrue(conference != null); log.debug("conference @" + conference); assertTrue("JUD2013".equals(conference.getName())); // query by slug conference = conferenceDao.findBySlug("jud-2014"); assertTrue(conference != null); assertTrue("JUD2013".equals(conference.getName())); // query by slug conference = conferenceDao.findBySlug("jud-2013-1"); assertTrue(conference == null); }
@Test() @Transactional public void deleteConference() { Long id = conferenceDao.save(newConference()); assertTrue(id != null); log.debug("id @=" + id); Conference conference = conferenceDao.findById(id); assertTrue(conference != null); conferenceDao.delete(conference); conference = conferenceDao.findById(id); log.debug("conference@" + conference); assertTrue(conference == null); }
@Test @Transactional public void updateConference() { Long id = conferenceDao.save(newConference()); assertTrue(id != null); log.debug("id @=" + id); Conference conference = conferenceDao.findById(id); assertTrue(conference != null); assertTrue("JUD2013".equals(conference.getName())); String name = "JUD2013Boston"; conference.setName(name); conferenceDao.update(conference); conference = conferenceDao.findById(id); assertTrue(name.equals(conference.getName())); }
@After @Transactional public void afterTestCase() { log.debug("===================after test====================="); conferenceDao.deleteAll(); }