当前位置:   article > 正文

spring boot 单元测试调用Service接口_怎么在springboot项目的测试类调用service层的一些东西

怎么在springboot项目的测试类调用service层的一些东西
  1. package com.inco;
  2. import com.inco.project.ggjk.ksgl.service.KsglGgjkService;
  3. import com.inco.project.pub.gly.ksgl.zjkap.service.ZjkapService;
  4. import org.junit.Test;
  5. import org.junit.runner.RunWith;
  6. import org.springframework.boot.test.context.SpringBootTest;
  7. import org.springframework.test.annotation.Rollback;
  8. import org.springframework.test.context.junit4.SpringRunner;
  9. import org.springframework.transaction.annotation.Transactional;
  10. import javax.annotation.Resource;
  11. import java.util.HashMap;
  12. import java.util.Map;
  13. @RunWith(SpringRunner.class)
  14. @SpringBootTest(classes = IncoDemoApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  15. @Transactional
  16. @Rollback
  17. public class ServiceImplTests {
  18. @Resource(name="com.inco.project.pub.gly.ksgl.zjkap.service.ZjkapService")
  19. private ZjkapService zjkapService;
  20. @Resource(name="com.inco.project.ggjk.ksgl.service.KsglGgjkService")
  21. private KsglGgjkService ksglGgjkService;
  22. @Test
  23. public void adMe(){
  24. // ZjkapPage page = new ZjkapPage();
  25. // page.setPxn("2019-2020");
  26. // page.setPxq("1");
  27. // page.setPkslx("ZK");
  28. // page.setPkssjdm("02");
  29. // page.setPpylx("1");
  30. // zjkapService.updateJkxyAndMe(page);
  31. Map m = new HashMap();
  32. m.put("ydid","9A21A4F07AA64BFEE0530B18F80A65F7");
  33. ksglGgjkService.deleteXsksapb(m);
  34. }
  35. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/580124
推荐阅读
相关标签
  

闽ICP备14008679号