Detected code, here are some useful tools:
Formatted code
package com.example;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders. * ;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * ;
import org.junit.jupiter.api.BeforeEach;
import org.junit.Test;
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;
@SpringJUnitWebConfig(locations = "test-servlet-context.xml") class ExampleTests {
MockMvc mockMvc;
@BeforeEach
void setup(WebApplicationContext wac) {
this .mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
@Test
public void testHomePage() throws Exception {
mockMvc.perform(get("/AccessPoint")).andExpect(status().isOk()).andExpect(view().name("login"));
}
}