mybatis测试类

来源:互联网 发布:乐视有没有mac 编辑:程序博客网 时间:2024/06/10 12:34
public class RechargeRecordTest {


private SqlMapClient  sqlMapClient;

private ApplicationContext context;
// 此方法是在执行testFindUserById之前执行
@org.junit.Before
public void setUp() throws Exception {
String resource = "com/fenghu/config/SqlMapConfig.xml";
InputStream inputStream = null;
inputStream = Resources.getResourceAsStream(resource);
SqlMapClient  sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(inputStream);

context = new ClassPathXmlApplicationContext("com/fenghu/config/applicationContext.xml");



}

@Test
public void updateRecordAndHistoryTest() throws Exception{
RechargeRecordBiz userService = (RechargeRecordBiz) context.getBean("rechargeRecordBiz");
Rechargerecord  rechargerecord = new Rechargerecord();
rechargerecord.setAvailableamount(50d);
rechargerecord.setOrderid(1000001);
rechargerecord.setRechargeamount(200d);
rechargerecord.setRechargedate(new Date());
rechargerecord.setRechargetype(2);
rechargerecord.setUsername("18300087973");
rechargerecord.setUsestatus(0);

String msg = userService.insertRechReco(rechargerecord,new Htrecord());
System.out.println(msg);



}

}

0 0
原创粉丝点击