RequestUtilsTestpublic class RequestUtilsTest extends TestCase
Fields Summary |
---|
private org.easymock.MockControl | control | private HttpServletRequest | requestMock |
Methods Summary |
---|
protected void | setUp()
control = MockControl.createControl(HttpServletRequest.class);
requestMock = (HttpServletRequest) control.getMock();
| public void | testGetServletPathWithRequestURIAndContextPathSet()
control.expectAndReturn(requestMock.getServletPath(), null);
control.expectAndReturn(requestMock.getRequestURI(), "/servlet/mycontext/test.jsp");
control.expectAndReturn(requestMock.getContextPath(), "/servlet");
control.expectAndReturn(requestMock.getContextPath(), "/servlet");
control.expectAndReturn(requestMock.getPathInfo(), "test.jsp");
control.expectAndReturn(requestMock.getPathInfo(), "test.jsp");
control.replay();
assertEquals("/mycontext/", RequestUtils.getServletPath(requestMock));
control.verify();
| public void | testGetServletPathWithRequestURIAndContextPathSetButNoPatchInfo()
control.expectAndReturn(requestMock.getServletPath(), null);
control.expectAndReturn(requestMock.getRequestURI(), "/servlet/mycontext/");
control.expectAndReturn(requestMock.getContextPath(), "/servlet");
control.expectAndReturn(requestMock.getContextPath(), "/servlet");
control.expectAndReturn(requestMock.getPathInfo(), null);
control.replay();
assertEquals("/mycontext/", RequestUtils.getServletPath(requestMock));
control.verify();
| public void | testGetServletPathWithRequestURIAndEmptyContextPath()
control.expectAndReturn(requestMock.getServletPath(), null);
control.expectAndReturn(requestMock.getRequestURI(), "/mycontext/test.jsp");
control.expectAndReturn(requestMock.getContextPath(), "");
control.expectAndReturn(requestMock.getPathInfo(), "test.jsp");
control.expectAndReturn(requestMock.getPathInfo(), "test.jsp");
control.replay();
assertEquals("/mycontext/", RequestUtils.getServletPath(requestMock));
control.verify();
| public void | testGetServletPathWithServletPathSet()
control.expectAndReturn(requestMock.getServletPath(), "/mycontext/");
control.replay();
assertEquals("/mycontext/", RequestUtils.getServletPath(requestMock));
control.verify();
|
|