Example usage for org.springframework.mock.web MockServletContext registerContext

List of usage examples for org.springframework.mock.web MockServletContext registerContext

Introduction

In this page you can find the example usage for org.springframework.mock.web MockServletContext registerContext.

Prototype

public void registerContext(String contextPath, ServletContext context) 

Source Link

Usage

From source file:org.parancoe.web.test.BaseTest.java

@Override
protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
    FileSystemResourceLoader rl = new FileSystemResourceLoader();
    MockServletContext servletContext = new MockServletContext(rl);
    servletContext.setMinorVersion(4);//from ww w . j a  v  a2  s  . c o m
    servletContext.registerContext("/test", servletContext);
    servletContext.setServletContextName("/test");
    servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, arrayToString(locations));
    ContextLoader loader = new ContextLoader();
    WebApplicationContext context = loader.initWebApplicationContext(servletContext);
    return (ConfigurableApplicationContext) context;
}