use of com.helger.servlet.mock.MockServletContext in project ph-web by phax.
the class RequestHelperTest method testGetRequestURI.
@Test
public void testGetRequestURI() {
final MockServletContext aSC = MockServletContext.create();
try {
MockHttpServletRequest r = new MockHttpServletRequest(aSC, EHttpMethod.GET).setAllPaths("/context/servlet/index.xyz?x=1");
assertEquals("/context/servlet/index.xyz", RequestHelper.getRequestURIDecoded(r));
r.addParameter("abc", "xyz");
assertEquals("/context/servlet/index.xyz", RequestHelper.getRequestURIDecoded(r));
r = new MockHttpServletRequest(aSC, EHttpMethod.GET).setAllPaths("/context/servlet/in%3adex.xyz?x=1");
assertEquals("/context/servlet/in:dex.xyz", RequestHelper.getRequestURIDecoded(r));
assertEquals("/context/servlet/in%3adex.xyz", RequestHelper.getRequestURIEncoded(r));
r.addParameter("abc", "xyz");
assertEquals("/context/servlet/in:dex.xyz", RequestHelper.getRequestURIDecoded(r));
assertEquals("/context/servlet/in%3adex.xyz", RequestHelper.getRequestURIEncoded(r));
} finally {
aSC.invalidate();
}
}
use of com.helger.servlet.mock.MockServletContext in project ph-web by phax.
the class RequestLoggerTest method testBasic.
@Test
public void testBasic() {
final MockServletContext aSC = MockServletContext.create();
try {
final HttpServletRequest aHttpRequest = new MockHttpServletRequest(aSC);
assertNotNull(RequestLogger.getRequestFieldMap(aHttpRequest));
} finally {
aSC.invalidate();
}
}
Aggregations