|
30 | 30 | @WebAppConfiguration |
31 | 31 | @ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class }) |
32 | 32 | public class ExpressionUtilityObjectsControllerIntegrationTest { |
33 | | - |
| 33 | + |
| 34 | + @Autowired |
| 35 | + WebApplicationContext wac; |
34 | 36 | @Autowired |
35 | | - WebApplicationContext wac; |
36 | | - @Autowired |
37 | | - MockHttpSession session; |
| 37 | + MockHttpSession session; |
38 | 38 |
|
39 | | - private MockMvc mockMvc; |
| 39 | + private MockMvc mockMvc; |
| 40 | + |
| 41 | + @Autowired |
| 42 | + private Filter springSecurityFilterChain; |
40 | 43 |
|
41 | | - @Autowired |
42 | | - private Filter springSecurityFilterChain; |
| 44 | + protected RequestPostProcessor testUser() { |
| 45 | + return user("user1").password("user1Pass").roles("USER"); |
| 46 | + } |
43 | 47 |
|
44 | | - protected RequestPostProcessor testUser() { |
45 | | - return user("user1").password("user1Pass").roles("USER"); |
46 | | - } |
| 48 | + @Before |
| 49 | + public void setup() { |
| 50 | + mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilters(springSecurityFilterChain).build(); |
| 51 | + } |
47 | 52 |
|
48 | | - @Before |
49 | | - public void setup() { |
50 | | - mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilters(springSecurityFilterChain).build(); |
51 | | - } |
| 53 | + @Test |
| 54 | + public void testGetObjects() throws Exception { |
| 55 | + mockMvc.perform(get("/objects").with(testUser()).with(csrf())).andExpect(status().isOk()) |
| 56 | + .andExpect(view().name("objects.html")); |
| 57 | + } |
52 | 58 |
|
53 | 59 | @Test |
54 | | - public void testGetDates() throws Exception{ |
55 | | - mockMvc.perform(get("/objects").with(testUser()).with(csrf())).andExpect(status().isOk()).andExpect(view().name("objects.html")); |
| 60 | + public void testDates() throws Exception { |
| 61 | + mockMvc.perform(get("/dates").with(testUser()).with(csrf())).andExpect(status().isOk()) |
| 62 | + .andExpect(view().name("dates.html")); |
56 | 63 | } |
57 | 64 |
|
58 | 65 | } |
0 commit comments