单元测试 junit
来源:互联网 发布:appuploader windows 编辑:程序博客网 时间:2024/06/10 22:41
import java.util.HashMap;import java.util.List;import java.util.Map;import org.junit.Assert;import org.junit.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.test.context.ContextConfiguration;import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;@ContextConfiguration(locations = {"file:src/test/resources/test-service.xml"})public class CountInfoServiceImplTest extends AbstractTransactionalJUnit4SpringContextTests{@Autowiredprivate CountInfoService countInfoService;@Testpublic void testDendMsg() {ApplyClaimReq req = new ApplyClaimReq();req.setWaybillNo("493050030200");req.setJobId("2153397205");req.setOpenId("sdffds432423dfdfs432423");req.setSendPhone("13711111111");req.setClaimer("小哥");req.setClaimerPhone("13733333333");Result r = (Result) countInfoService.sendMsg(req);Assert.assertTrue(r.isSuccess()); }}//test-service.xml配置文件<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"><!-- <import resource="classpath*:META-INF/spring/spring*.xml" /> --><import resource="classpath*:META-INF/spring/spring-config*.xml" /><import resource="classpath*:META-INF/spring/spring-ehcache*.xml" /></beans>
阅读全文