提交 91ba2298 编写于 作者: M Matt Dolan 提交者: Jeremy Watson

Updated to latest Spring Boot 2.3.2.RELEASE and JUnit 5.

上级 12b0a874
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version> <version>2.3.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
......
package com.example.demo; package com.example.demo;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringRunner; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class DemoApplicationTests { public class DemoApplicationTests {
...@@ -23,6 +20,6 @@ public class DemoApplicationTests { ...@@ -23,6 +20,6 @@ public class DemoApplicationTests {
@Test @Test
public void homeResponse() { public void homeResponse() {
String body = this.restTemplate.getForObject("/", String.class); String body = this.restTemplate.getForObject("/", String.class);
assertThat(body).isEqualTo("Spring is here!"); assertEquals("Spring is here!", body);
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册