spring boot 单元测试调用Service接口

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

 

おすすめ

転載: blog.csdn.net/ding43930053/article/details/106693962