SmsReceiveDAO extends BaseIbatisDAO { public SmsReceive save(final SmsReceive smsReceive) { super.insert("SMS_RECEIVE.insert", smsReceive); if (LOG.isDebugEnabled()) { LOG.debug("save " + smsReceive + " successfully!"); } return smsReceive; }  SmsReceive save(final SmsReceive smsReceive);  }
@Test public void testSave() throws Exception { Date now = new Date(); SmsReceive receive = new SmsReceive(); receive.setChannelNumber("60601010"); receive.setContent("LVMAMA"); receive.setMobileNumber("13917677725"); receive.setSendDate(now); smsReceiveDAO.save(receive); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM SMS_RECEIVE WHERE channel_number = '60601010' AND content = 'LVMAMA'"); if (rs.next()) { Assert.assertEquals(rs.getString("channel_number"), receive.getChannelNumber()); Assert.assertEquals(rs.getString("content"), receive.getContent()); Assert.assertEquals(rs.getString("mobile_number"), receive.getMobileNumber()); Assert.assertEquals(rs.getDate("send_date"), receive.getSendDate()); Assert.assertNotNull(rs.getLong("id")); Assert.assertNotNull(rs.getDate("create_date")); Assert.assertTrue(rs.isAfterLast()); } else { fail("未插入任何数据"); } }