コード例 #1
0
  /** 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());
  }
コード例 #2
0
  /** Test of save method, of class MessagTemplateDAOImpl. */
  @Test
  public void testGetTemplateByLangNotifMType() {
    System.out.println("getTemplateByLangNotifMType");

    mtDao.getSessionFactory().getCurrentSession().save(mt2);

    MessageTemplate result = mtDao.getTemplateByLangNotifMType(l1, nt2, type);
    Assert.assertNotNull(result);
    Assert.assertEquals(mt2, result);
  }
コード例 #3
0
  /** 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);
  }
コード例 #4
0
  /** 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);
  }