欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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);
    }
}