Esempio n. 1
0
  @Test
  public void testSearch() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZaihouJiaobDAO zaihjDao = (ZaihouJiaobDAO) ctx.getBean("zaihoujiaobDao");

    ZaihouJiaob z = new ZaihouJiaob();
    z.setId(1);
    Assert.assertEquals(1, zaihjDao.search(z).size());
  }
Esempio n. 2
0
  @Test
  public void testDelete() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZaihouJiaobDAO zaihjDao = (ZaihouJiaobDAO) ctx.getBean("zaihoujiaobDao");
    ZaihouJiaob z = new ZaihouJiaob();
    z.setId(1);

    zaihjDao.delete(z);
  }
Esempio n. 3
0
  @Test
  public void testInsert() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZaihouJiaobDAO zaihjDao = (ZaihouJiaobDAO) ctx.getBean("zaihoujiaobDao");

    ZaihouJiaob z = new ZaihouJiaob();
    Zaihou zh = new Zaihou();
    zh.setId(1);

    z.setJiaobiao_id("aaasssss");
    z.setZaihou_id(zh);
    z.setResult("sidjiasjd");
    zaihjDao.insert(z);

    // All need is to create an instance with primary key
  }