spring boot 单元测试调用Service接口
程序员文章站
2022-04-26 09:18:09
...
package com.inco;
import com.inco.project.ggjk.ksgl.service.KsglGgjkService;
import com.inco.project.pub.gly.ksgl.zjkap.service.ZjkapService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IncoDemoApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Transactional
@Rollback
public class ServiceImplTests {
@Resource(name="com.inco.project.pub.gly.ksgl.zjkap.service.ZjkapService")
private ZjkapService zjkapService;
@Resource(name="com.inco.project.ggjk.ksgl.service.KsglGgjkService")
private KsglGgjkService ksglGgjkService;
@Test
public void adMe(){
// ZjkapPage page = new ZjkapPage();
// page.setPxn("2019-2020");
// page.setPxq("1");
// page.setPkslx("ZK");
// page.setPkssjdm("02");
// page.setPpylx("1");
// zjkapService.updateJkxyAndMe(page);
Map m = new HashMap();
m.put("ydid","9A21A4F07AA64BFEE0530B18F80A65F7");
ksglGgjkService.deleteXsksapb(m);
}
}
推荐阅读
-
深入理解spring boot异步调用方式@Async
-
详解Spring Boot实战之Filter实现使用JWT进行接口认证
-
spring boot 2 集成JWT实现api接口认证
-
详解Spring Boot Junit单元测试
-
详解Spring Boot实战之单元测试
-
快速入门Spring Boot之开发你的第一个JSON接口
-
Spring-Boot ☞ ShapeFile文件读写工具类+接口调用
-
Spring Boot + Redis 实现接口幂等性
-
Spring Boot通过Junit实现单元测试过程解析
-
spring cloud boot 启动报错java.lang.IllegalStateException: Service id not legal hostname (/user-service)