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 org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
@SpringBootTest
@AutoConfigureMockMvc
public class MyControllerIntegrationTest {
@Autowired
private MockMvc mockMvc;
@Test
public void testProcessInput() throws Exception {
String userInput = "Test Input";
mockMvc.perform(MockMvcRequestBuilders.post("/processInput")
.param("userInput", userInput))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.view().name("result"))
.andExpect(MockMvcResultMatchers.model().attribute("userInput", userInput));
}
}