MockAcrossServletContext is an extension of the
MockServletContext from Spring Test.
It adds an implementation that keeps track of all registered servlets, filters and listeners.
MockServletContext this implementation does not throw an
UnsupportedOperationException on registration operations.
For common operations like servlet and filter registration this implementation will behave as an actual
ServletContext from a web container.
The actual registrations that occurred can be retrieved - in order - from the
MockAcrossServletContext can also mimic initialization of the
initialize() is called, the
init() methods of the servlet/filter instances will be called with the registration parameters.
initialize() can be called only once, and afterwards all registration operations will throw an
MockAcrossServletContext can be used for unit testing
AcrossWebDynamicServletConfigurer implementations or for integration tests needing web functionality.
MockAcrossServletContext is used automatically behind the scenes when using the test builders or annotations.
In an integration test scenario, the implementation can either be wired as a bean (when using the annotations) or retrieved from the resulting
Please refer to the javadoc for
MockAcrossServletContext for more information.