![]()
package com.java.test1;
import com.java.test1.controller.OrderController;
import org.junit.jupiter.api.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.SpringRunner;
@RunWith(SpringRunner.class)//运行器 SpringRunner.class标识springboot的单元测试
@SpringBootTest//标识是一个springboot测试类,主要加载上下文的配置文件
class Test01ApplicationTests {
@Autowired
private OrderController orderController;
@Test
void contextLoads() {
String buy = orderController.buy();
System.out.println(buy);
}
}