Exemplo n.º 1
0
  @Test
  public void testDelete() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZhunzaiDAO zhunzaiDao = (ZhunzaiDAO) ctx.getBean("zhunzaiDao");

    Zhunzai z = new Zhunzai();
    z.setId(1);
    zhunzaiDao.delete(z);
  }
Exemplo n.º 2
0
  @Test
  public void testSearch() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZhunzaiDAO zhunzaiDao = (ZhunzaiDAO) ctx.getBean("zhunzaiDao");

    Zhunzai z = new Zhunzai();
    z.setId(1);

    Assert.assertEquals(1, zhunzaiDao.search(z).size());
  }
Exemplo n.º 3
0
  @Test
  public void testUpdate() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZhunzaiDAO zhunzaiDao = (ZhunzaiDAO) ctx.getBean("zhunzaiDao");

    Zhunzai z = new Zhunzai();
    z.setId(1);
    Yuangong yg = new Yuangong();
    yg.setId(2);
    z.setFz_person(yg);

    zhunzaiDao.update(z);
  }