@Before
public void setUp() throws ServletException, ServletInitializationException {
servletContainer = mock(ServletContainer.class);
when(servletContainer.getServletForClass(any(Class.class), any(ServletConfig.class))).
thenReturn(mock(Servlet.class));
servletContext = mock(ServletContextImpl.class);
when(servletContext.getContextPath()).thenReturn("/");
ServletMapping servletMapping = new ServletMappingImpl(Pattern.compile("^.*$"), SampleServlet.class);
when(servletContext.getServletMappings()).thenReturn(Arrays.asList(servletMapping));
when(servletContext.getFilterMappings()).thenReturn(Collections.<FilterMapping>emptyList());
servletResourceProvider = new ServletResourceProvider(
servletContainer,
Arrays.asList(servletContext)
);
response = new HttpServletResponseImpl(mock(
Serializer.class),
mock(Serializer.class),
mock(StreamHelper.class),
mock(OutputStream.class));
request = mock(HttpServletRequestImpl.class);
when(request.getServletContext()).thenReturn(servletContext);
}