Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IntegrationTest
- @RunWith(SpringJUnit4ClassRunner.class)
- @SpringApplicationConfiguration(classes = App.class)
- @WebAppConfiguration
- public class RestTest {
- @Autowired
- private WebApplicationContext wac;
- @Autowired
- private Filter springSecurityFilterChain;
- private MockMvc mockMvc;
- @Before
- public void setUp() {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).
- addFilters(springSecurityFilterChain).build();
- this.mapper = new ObjectMapper();
- }
- @Test
- public void testLogin() throws Exception {
- MvcResult result;
- MockHttpServletRequestBuilder req;
- result = mockMvc.perform(get("/login/csrf")).andExpect(status().is(200)).andReturn();
- Cookie[] cookie = result.getResponse().getCookies();
- System.out.println(cookie.length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement