Spring Initializr: 3.1.0-M2 / Spring WebMVC / Thymeleaf
[demos/spring-boot] / src / test / java / de / juplo / demo / DemoApplicationTests.java
1 package de.juplo.demo;
2
3 import org.junit.jupiter.api.Test;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
6 import org.springframework.boot.test.context.SpringBootTest;
7 import org.springframework.test.web.servlet.MockMvc;
8
9 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
10 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
11
12
13 @SpringBootTest
14 @AutoConfigureMockMvc
15 class DemoApplicationTests {
16
17         @Test
18         void contextLoads() {
19         }
20
21
22         @Test
23         void getWelcomeResponseIsOk(@Autowired MockMvc mvc) throws Exception
24         {
25                 mvc.perform(get("/")).andExpect(status().isOk());
26         }
27 }