/** Test of save method with update purpose, of class MessagTemplateDAOImpl. */ @Test public void testUpdate() { System.out.println("test MessageTemplateDAO update"); String alttemplate = "altered template"; Date altdate = new Date(); MessageTemplate fromdb1 = (MessageTemplateImpl) mtDao .getSessionFactory() .getCurrentSession() .get(MessageTemplateImpl.class, mt5.getId()); fromdb1.setDateCreated(altdate); fromdb1.setMessageType(type); fromdb1.setNotificationType(nt2); fromdb1.setTemplate(alttemplate); mtDao.save(fromdb1); MessageTemplate fromdb = (MessageTemplateImpl) mtDao .getSessionFactory() .getCurrentSession() .get(MessageTemplateImpl.class, fromdb1.getId()); Assert.assertNotNull(fromdb); Assert.assertEquals(mt5, fromdb); Assert.assertEquals(nt2, fromdb.getNotificationType()); Assert.assertEquals(alttemplate, fromdb.getTemplate()); Assert.assertEquals(altdate, fromdb.getDateCreated()); }
/** Test of getById method, of class MessagTemplateDAOImpl. */ @Test public void testGetById() { System.out.println("test MessageTemplate getById"); MessageTemplate mt = (MessageTemplate) mtDao.getById(mt3.getId()); Assert.assertNotNull(mt); Assert.assertEquals(mt3, mt); Assert.assertEquals(mt3.getId(), mt.getId()); Assert.assertEquals(mt3.getLanguage(), mt.getLanguage()); Assert.assertEquals(mt3.getTemplate(), mt.getTemplate()); }
/** Test of delete method, of class MessagTemplateDAOImpl. */ @Test public void testDelete() { System.out.println("test MessageTemplate delete"); mtDao.delete(mt4); MessageTemplate fromdb = (MessageTemplate) mtDao .getSessionFactory() .getCurrentSession() .get(MessageTemplateImpl.class, mt4.getId()); Assert.assertNull(fromdb); }
/** Test of save method, of class MessagTemplateDAOImpl. */ @Test public void testSave() { System.out.print("test save MessageTemplate Object"); mtDao.save(mt1); MessageTemplate fromdb = (MessageTemplate) mtDao .getSessionFactory() .getCurrentSession() .get(MessageTemplateImpl.class, mt1.getId()); Assert.assertNotNull(fromdb); }