List of usage examples for org.springframework.boot.test.context.assertj AssertableWebApplicationContext getBean
Object getBean(String name) throws BeansException;
From source file:org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfigurationTests.java
private int getResponseStatus(AssertableWebApplicationContext context, String path) throws IOException, javax.servlet.ServletException { FilterChainProxy filterChainProxy = context.getBean(FilterChainProxy.class); MockServletContext servletContext = new MockServletContext(); MockHttpServletResponse response = new MockHttpServletResponse(); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.setServletPath(path);// w w w. j av a 2 s.c om request.setMethod("GET"); filterChainProxy.doFilter(request, response, new MockFilterChain()); return response.getStatus(); }