SmsContentDAO extends BaseIbatisDAO { public void retrySend(final Serializable serialId) { super.insert("SMS_CONTENT.retrySend", serialId); }  SmsContent save(final SmsContent sms); @SuppressWarnings("unchecked") List<SmsContent> query(final Map<String, Object> parameters); void deleteByPrimaryKey(final Serializable id); void delete(final Map<String, Object> parameters); void updateFailureCount(final Serializable id); SmsContent getByPrimaryKey(final Serializable id); void retrySend(final Serializable serialId); static int getRule(); static void setRule(int rule); @SuppressWarnings("unchecked") List<SmsContent> queryByParam(Map<String, Object> param); void reSendSmsByMap(Map<Object, Object> extendParam); int update(SmsContent smsContent); void insert(SmsContent smsContent);  }
@Test public void testRetrySend() throws Exception { SmsContentLog log = new SmsContentLog("This is a test log", "13917677725"); log.setSerialId(12332112331212122l); log.setPriority(2); log.setFailure(0); smsContentLogDAO.save(log); smsContentDAO.retrySend(log.getSerialId()); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from sms_content where mobile = '13917677725' order by id desc"); rs.next(); Assert.assertNotNull(rs.getLong("id")); Assert.assertEquals(log.getContent(), rs.getString("content")); Assert.assertEquals(log.getMobile(), rs.getString("mobile")); Assert.assertEquals(log.getPriority().intValue(), rs.getInt("priority")); Assert.assertEquals(log.getType(), rs.getString("type")); Assert.assertNotNull(rs.getDate("send_date")); Assert.assertEquals(log.getFailure() + 1, rs.getInt("failure")); if (rs.next()) { fail("插入了多条数据!"); } }