JAVA-11420: Dissolve spring-boot-1 and spring-boot-2 inside (#12122)

spring-boot-modules
This commit is contained in:
freelansam
2022-04-28 22:45:45 +05:30
committed by GitHub
parent 01e30fef42
commit 4690807a09
56 changed files with 85 additions and 1203 deletions
@@ -0,0 +1,36 @@
package com.baeldung.servletinitializer;
import static org.hamcrest.CoreMatchers.containsString;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import com.baeldung.servletinitializer.WarInitializerApplication.WarInitializerController;
@RunWith(SpringRunner.class)
@WebMvcTest(controllers = WarInitializerController.class)
public class WarInitializerApplicationIntegrationTest {
@Autowired
private MockMvc mockMvc;
@Test
public void whenContextRootUrlIsAccessed_thenStatusIsOk() throws Exception {
mockMvc.perform(get("/"))
.andExpect(status().is(200));
}
@Test
public void whenContextRootUrlIsAccesed_thenCorrectStringIsReturned() throws Exception {
mockMvc.perform(get("/"))
.andExpect(content().string(containsString("WarInitializerApplication is up and running!")));
}
}