BAEL-1148 earth001@gmail.com - Merged spring-mvc-push module in spring-mvc-simple (#3459)
* Sample code for BAEL-1148 - earth001@gmail.com * Change tabs for spaces in non java files * Change tabs for spaces in non java files * Removed unnecessary argument * BAEL-1148 earth001@gmail.com - Mapped get method in controller / Removed resources * Merged spring-mvc-push module in spring-mvc-simple
This commit is contained in:
committed by
KevinGilmore
parent
a115c94f32
commit
b1266c833b
+39
@@ -0,0 +1,39 @@
|
||||
package com.baeldung.controller.push;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.spring.configuration.PushConfiguration;
|
||||
|
||||
@SpringJUnitWebConfig(PushConfiguration.class)
|
||||
public class PushControllerIntegrationTest {
|
||||
@Autowired
|
||||
private WebApplicationContext webAppContext;
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
mockMvc = MockMvcBuilders.webAppContextSetup(webAppContext)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenDemoWithPushGETisPerformed_thenRetrievedStatusOk() throws Exception {
|
||||
mockMvc.perform(get("/demoWithPush"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenDemoWithoutPushGETisPerformed_thenRetrievedStatusOk() throws Exception {
|
||||
mockMvc.perform(get("/demoWithoutPush"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user