// 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); }
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); }