List of usage examples for org.springframework.mock.web MockHttpServletRequest MockHttpServletRequest
public MockHttpServletRequest(@Nullable ServletContext servletContext, @Nullable String method,
@Nullable String requestURI)
From source file:org.atomserver.testutils.client.MockRequestContext.java
private static MockHttpServletRequest createRequest(String method, String uri) { MockServletContext ctx = new MockServletContext(); createBaseURI(uri);/*from w w w.jav a 2s .co m*/ return new MockHttpServletRequest(ctx, method, uri); }
From source file:org.dataone.annotator.store.AnnotatorStoreIT.java
public AnnotatorStoreIT() { request = new MockHttpServletRequest(null, null, null); }
From source file:ar.com.zauber.commons.web.proxy.impl.PathBasedURLRequestMapperTest.java
/** @throws Exception on error */ public final void testServletContext() throws Exception { final String ctxPath = "/nexusaaa-0.0"; final String servletContext = "/bin"; final PathBasedURLRequestMapper mapper = new PathBasedURLRequestMapper( new InmutableURLRequestMapper(new InmutableURLResult(new URL(base)))); mapper.setStripContextPath(true);/*from w w w .j ava2 s . c o m*/ mapper.setStripServletPath(true); final MockServletContext ctx = new MockServletContext(); final MockHttpServletRequest request = new MockHttpServletRequest(ctx, "GET", ctxPath + servletContext + "/"); request.setContextPath(ctxPath); request.setServletPath(servletContext); assertEquals(new URL(base + "/"), mapper.getProxiedURLFromRequest(request).getURL()); }
From source file:MockMVCTests.java
@Test public void test() throws Exception { mockMvc.perform(new RequestBuilder() { @Override//from ww w . j a va 2s . co m public MockHttpServletRequest buildRequest(ServletContext servletContext) { return new MockHttpServletRequest(servletContext, "GET", "/"); } }).andExpect(status().isOk()); }
From source file:org.jamwiki.servlets.WikiPageInfoTest.java
/** * *///from ww w . ja v a 2 s . c o m private MockHttpServletRequest getMockHttpServletRequest(String url) { MockServletContext mockContext = new MockServletContext("context"); return new MockHttpServletRequest(mockContext, "GET", url); }
From source file:ejportal.webapp.action.SignupActionTest.java
/** * Test display form./* w ww .j a v a 2s . co m*/ * * @throws Exception * the exception */ public void testDisplayForm() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(null, "GET", "/signup.html"); ServletActionContext.setRequest(request); Assert.assertEquals("input", this.action.execute()); }