Пример #1
0
  // testUpdate
  public void testUpdateSuccess() throws Exception {
    CRFBean sb = (CRFBean) cdao.findByPK(1);
    String keepName = sb.getName();
    sb.setName("new name");
    UserAccountBean ub = new UserAccountBean();
    ub.setId(1);
    sb.setUpdater(ub);

    sb.setStatus(Status.AVAILABLE);

    sb = (CRFBean) cdao.update(sb);
    sb.setName(keepName);
    CRFBean sbs = (CRFBean) cdao.update(sb);
    assertNotNull("test update", sbs);
  }
Пример #2
0
  public void testUpdateFail() throws Exception {
    CRFBean sb = (CRFBean) cdao.findByPK(1000);
    String keepName = sb.getName();
    sb.setName("new name");
    UserAccountBean ub = new UserAccountBean();
    ub.setId(2);
    sb.setUpdater(ub);

    sb.setStatus(Status.AVAILABLE);

    sb = (CRFBean) cdao.update(sb);
    sb.setName(keepName);
    CRFBean sbs = (CRFBean) cdao.update(sb);
    assertNotNull("test update", sbs);
    assertEquals("check primarykey", sb.getId(), 0);
  }
Пример #3
0
  public void testInsertFail() throws Exception {
    CRFBean cb = new CRFBean();
    cb.setName("test CRF -- please delete");
    cb.setStatus(Status.AVAILABLE);
    cb.setDescription("test CRF -- please delete");
    cb.setOwner(new UserAccountBean());
    CRFBean cbc = (CRFBean) cdao.create(cb);
    assertNotNull("test insert", cbc);

    assertEquals("check primarykey", cb.getId(), 0);
  }
Пример #4
0
 // testInsert
 public void testInsertSuccess() throws Exception {
   CRFBean cb = new CRFBean();
   cb.setName("test CRF -- please delete");
   cb.setStatus(Status.AVAILABLE);
   cb.setDescription("test CRF -- please delete");
   UserAccountBean ub = new UserAccountBean();
   ub.setId(1);
   cb.setOwner(ub);
   CRFBean cbc = (CRFBean) cdao.create(cb);
   assertNotNull("test insert", cbc);
 }