您的位置:首页 > 编程语言 > Java开发

java使用Test测试接口类

2016-01-04 14:14 459 查看
package com.jy.demo.web;

import java.util.Map;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.jy.modules.client.service.MainDataService;

public class InterfaceTest {
private static MainDataService mainDataService;

@BeforeClass
public static void setUpBeforeClass() throws Exception {
ClassPathXmlApplicationContext ct=new ClassPathXmlApplicationContext("spring-base.xml");//取到系统核心配置文件
mainDataService=ct.getBean("com.jy.modules.client.service.MainDataService",MainDataService.class);//从bean工程获取接口bean
}

@Test
//调用接口
public void testInterface2001(){
Map<String, String> map = null;
try {
map = mainDataService.searchCustInfoByCr("CR20150500000153");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: