public class ServletContextProviderRule
extends org.junit.rules.ExternalResource
TestRule
that sets up the ServletContextProvider framework before the test and tears it down
afterwards.
Typical usage:
@ClassRule public static ServletContextProviderRule servletContextProviderRule = setUpServletContextProvider();
Modifier and Type | Method and Description |
---|---|
protected void |
after() |
protected void |
before() |
javax.servlet.ServletContext |
getServletContext()
Returns the mock of
ServletContext used by the ServletContextProvider. |
static ServletContextProviderRule |
setUpServletContextProvider()
Creates an instance of this rule using a mocked
ServletContext . |
@Nonnull public static ServletContextProviderRule setUpServletContextProvider()
ServletContext
.
The servlet context can retrieved via getServletContext()
for mocking purposes.ServletContextProvider.getServletContext()
,
ServletContextProviderListener.contextInitialized(ServletContextEvent)
protected void before() throws Throwable
before
in class org.junit.rules.ExternalResource
Throwable
protected void after()
after
in class org.junit.rules.ExternalResource
@Nonnull public javax.servlet.ServletContext getServletContext()
ServletContext
used by the ServletContextProvider.Copyright © 2002-2022 Atlassian. All Rights Reserved.