cleanup formatting
This commit is contained in:
+23
-24
@@ -31,35 +31,34 @@ import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
|
||||
public class ExpressionUtilityObjectsControllerIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
WebApplicationContext wac;
|
||||
@Autowired
|
||||
MockHttpSession session;
|
||||
@Autowired
|
||||
WebApplicationContext wac;
|
||||
|
||||
@Autowired
|
||||
MockHttpSession session;
|
||||
|
||||
private MockMvc mockMvc;
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Autowired
|
||||
private Filter springSecurityFilterChain;
|
||||
@Autowired
|
||||
private Filter springSecurityFilterChain;
|
||||
|
||||
protected RequestPostProcessor testUser() {
|
||||
return user("user1").password("user1Pass").roles("USER");
|
||||
}
|
||||
protected RequestPostProcessor testUser() {
|
||||
return user("user1").password("user1Pass").roles("USER");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilters(springSecurityFilterChain).build();
|
||||
}
|
||||
@Before
|
||||
public void setup() {
|
||||
mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilters(springSecurityFilterChain).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjects() throws Exception {
|
||||
mockMvc.perform(get("/objects").with(testUser()).with(csrf())).andExpect(status().isOk())
|
||||
.andExpect(view().name("objects.html"));
|
||||
}
|
||||
@Test
|
||||
public void testGetObjects() throws Exception {
|
||||
mockMvc.perform(get("/objects").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("objects.html"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDates() throws Exception {
|
||||
mockMvc.perform(get("/dates").with(testUser()).with(csrf())).andExpect(status().isOk())
|
||||
.andExpect(view().name("dates.html"));
|
||||
}
|
||||
@Test
|
||||
public void testDates() throws Exception {
|
||||
mockMvc.perform(get("/dates").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("dates.html"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -31,7 +31,7 @@ import com.baeldung.thymeleaf.config.WebMVCSecurity;
|
||||
@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
|
||||
public class LayoutDialectControllerIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
WebApplicationContext wac;
|
||||
@Autowired
|
||||
MockHttpSession session;
|
||||
@@ -50,9 +50,9 @@ public class LayoutDialectControllerIntegrationTest {
|
||||
mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilters(springSecurityFilterChain).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDates() throws Exception{
|
||||
mockMvc.perform(get("/layout").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("content.html"));
|
||||
}
|
||||
@Test
|
||||
public void testGetDates() throws Exception {
|
||||
mockMvc.perform(get("/layout").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("content.html"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -59,17 +59,17 @@ public class CsrfEnabledIntegrationTest {
|
||||
public void addStudentWithCSRF() throws Exception {
|
||||
mockMvc.perform(post("/saveStudent").contentType(MediaType.APPLICATION_JSON).param("id", "1234567").param("name", "Joe").param("gender", "M").with(testUser()).with(csrf())).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void htmlInliningTest() throws Exception {
|
||||
mockMvc.perform(get("/html").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("inliningExample.html"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void jsInliningTest() throws Exception {
|
||||
mockMvc.perform(get("/js").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("studentCheck.js"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void plainInliningTest() throws Exception {
|
||||
mockMvc.perform(get("/plain").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("studentsList.txt"));
|
||||
|
||||
Reference in New Issue
Block a user