use of testutils.mock.MockRequest in project runwar by cfmlprojects.
the class UrlRewriteFilterTest method simpleApacheHConf.
@Test
public void simpleApacheHConf() throws IOException, ServletException, InvocationTargetException {
Conf conf = new Conf(servletContext, new FileInputStream(new File("src/test/resources/urlrewrite.htaccess")), "urlrewrite.htaccess", null, true);
assertTrue(conf.isEngineEnabled());
assertTrue(conf.isOk());
assertTrue(conf.getRules().size() > 0);
NormalRewrittenUrl rewrittenRequest;
MockRequest request;
UrlRewriter urlRewriter = new UrlRewriter(conf);
request = new MockRequest("/notthere");
rewrittenRequest = (NormalRewrittenUrl) urlRewriter.processRequest(request, response);
assertNotNull(rewrittenRequest);
assertEquals("index.cfm/notthere", rewrittenRequest.getTarget());
}
Aggregations