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

javaWeb服务详解【客户端调用】(含源代码,测试通过,注释) ——测试

2017-06-02 17:16 453 查看
Dept测试

@Test
public void test() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
IDeptService deptService = (IDeptService) ctx.getBean("wsClient");
List<Dept> depts = deptService.getDepts();
for (Dept dept : depts) {
System.out.println("部门名称:"+dept.getDname()+",部门地址:"+dept.getLoc());
System.out.println("员工表:"+dept.getEmps());
}
}

Emp测试
IEmpService empService;
@Before
public void init(){
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
empService=(IEmpService)ctx.getBean("wsClientEmp");
}
@Test
public void testGetEmps() {
List<Emp> getEmps= empService.getEmps();
for (Emp emp : getEmps) {
System.out.println(emp.getEname());
System.out.print("\t"+emp.getJob());
System.out.print("\t"+emp.getComm());
System.out.print("\t"+emp.getDept().getDname());
}
}

@Test
public void testGetEmpById() {
Emp emp = empService.getEmpById(7369);

System.out.println(emp.getEname()+"*********"+emp.getEmpno()+"*********"+emp.getDept().getDname());

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