1 import com.alibaba.fastjson.JSON; 2 import com.alibaba.fastjson.JSONObject; 3 import com.lgq.ai.YouProjectApplication; 4 import com.lgq.ai.service.XxxService; 5 import org.junit.Test; 6 import org.junit.runner.RunWith; 7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Value; 9 import org.springframework.boot.test.context.SpringBootTest; 10 import org.springframework.test.context.junit4.SpringRunner; 11 12 @RunWith(SpringRunner.class) 13 //YouProjectApplication 项目的启动文件名。 14 @SpringBootTest(classes = YouProjectApplication.class) 15 public class test { 16 17 //引用需测试的服务接口类。 18 @Autowired 19 public XxxService xxxService; 20 21 @Test 22 public void t() { 23 24 xxxService.test(); 25 26 } 27 }
标签:java,springframework,测试,org,test,import,com,class From: https://www.cnblogs.com/liuguiqing/p/18425174