SmsInstructionDAO extends BaseIbatisDAO { public void update(final SmsInstruction instructions) { super.update("SMS_INSTRUCTION.update", instructions); }  @SuppressWarnings("unchecked") List<SmsInstruction> query(final Map<String, Object> param); SmsInstruction save(final SmsInstruction instructions); void deleteByPrimaryKey(final String instructionCode); void update(final SmsInstruction instructions); SmsInstruction queryByPrimaryKey(final String instructionCode); Long count(final Map<String, Object> param);  }
@Test public void testUpdate() throws Exception { SmsInstruction instruction = new SmsInstruction(); instruction.setCouponCode("couponCode"); instruction.setCouponId("23,233,231"); instruction.setDescription("测试用例"); instruction.setInstructionCode("test321"); smsInstructionDAO.save(instruction); instruction.setDescription("测试用例123"); instruction.setCouponCode("yyddd"); smsInstructionDAO.update(instruction); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM sms_instruction WHERE instruction_code = 'test321' AND coupon_code = 'yyddd'"); if (rs.next()) { Assert.assertEquals(rs.getString("instruction_code"), instruction.getInstructionCode()); Assert.assertEquals(rs.getString("coupon_code"), instruction.getCouponCode()); Assert.assertEquals(rs.getString("DESCRIPTION"), instruction.getDescription()); Assert.assertEquals(rs.getString("coupon_id"), instruction.getCouponId()); Assert.assertTrue(rs.isAfterLast()); } else { fail("未更新任何数据"); } }