Spring Initializr: 3.1.0-M2 / Spring WebMVC / Thymeleaf
[demos/spring-boot] / src / test / java / de / juplo / demo / DemoApplicationTests.java
index 791a60b..850debd 100644 (file)
@@ -1,13 +1,27 @@
 package de.juplo.demo;
 
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.web.servlet.MockMvc;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
 
 @SpringBootTest
+@AutoConfigureMockMvc
 class DemoApplicationTests {
 
        @Test
        void contextLoads() {
        }
 
+
+       @Test
+       void getWelcomeResponseIsOk(@Autowired MockMvc mvc) throws Exception
+       {
+               mvc.perform(get("/")).andExpect(status().isOk());
+       }
 }