springboot测试service层的单元测试


package com.test.service;

import com.task.Application;
import com.task.model.po.TaskRecordDo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* Created by admin on 2017/9/21-11:33.
* Description :
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
public class TaskRecordServiceTest {
@Autowired
private TaskRecordService taskRecordService;

@Test
public void insertTest(){
TaskRecordDo taskRecordDo = new TaskRecordDo("8654111110001", "11110001", "adminTask", "UUIDTest", "修改生产服设备ID", "200");
taskRecordService.insertTaskRecord(taskRecordDo);
}
}

*注意
一个简单的测试单元就这样成功了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM