一、热部署课后作业
1.上一讲的课后作业StudentInfo项目进行单元测试
package net.lj.lesson01;
import net.lj.lesson01.controller.StudentInfoController;
import org.junit.Assert;
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)
@SpringBootTest
public class StudentinfoApplicationTests {
//注入待测试类
@Autowired
private StudentInfoController controller;
@Test
void contextLoads() {
String student =controller.student();
Assert.assertSame("<h3>你好,Spring Boot世界!</h3>",student);
}
}
运行测试方法,查看结果
任务2、按照讲稿实现热部署,并针对项目StudentInfo进行热部署测试
最后就在测试类添加自己信息运行