예제 #1
0
  public void testFilterDoesntForwardWhenPathMatches() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/scripts/dojo/test.html");
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockFilterChain chain = new MockFilterChain();

    filter.doFilter(request, response, chain);

    assertNull(chain.getForwardURL());
  }
예제 #2
0
  public void testFilterForwardsWhenPathDoesntMatch() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/editProfile.html");
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockFilterChain chain = new MockFilterChain();

    filter.doFilter(request, response, chain);

    assertNotNull(chain.getForwardURL());
  }
예제 #3
0
 protected void setUp() throws Exception {
   filter = new StaticFilter();
   MockFilterConfig config = new MockFilterConfig();
   config.addInitParameter("includes", "/scripts/*");
   filter.init(config);
 }