View Javadoc
1 /* 2 * Angkor Web Framework 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 8 package com.tirsen.angkor.test.unit; 9 10 import org.apache.commons.logging.Log; 11 import org.apache.commons.logging.LogFactory; 12 import junit.framework.TestCase; 13 import com.tirsen.angkor.ApplicationFilter; 14 import com.tirsen.angkor.test.unit.mock.*; 15 16 import javax.servlet.*; 17 import java.util.Enumeration; 18 import java.io.IOException; 19 20 /*** 21 * TODO document ApplicationFilterTest 22 * 23 * <!-- $Id: ApplicationFilterTest.java,v 1.3 2002/10/13 13:37:26 tirsen Exp $ --> 24 * 25 * @author $Author: tirsen $ 26 * @version $Revision: 1.3 $ 27 */ 28 public class ApplicationFilterTest extends TestCase 29 { 30 private static Log logger = LogFactory.getLog(ApplicationFilterTest.class); 31 32 public void testFilter() throws ServletException, IOException 33 { 34 MockFilterConfig filterConfig = new MockFilterConfig(); 35 36 ApplicationFilter applicationFilter = new ApplicationFilter(); 37 38 // without configuration 39 try 40 { 41 applicationFilter.init(filterConfig); 42 fail(); 43 } 44 catch(Exception shouldHappen) 45 { 46 } 47 48 filterConfig.setInitParameter(ApplicationFilter.APPLICATION_CLASS_PARAM, MockApplication.class.getName()); 49 applicationFilter.init(filterConfig); 50 51 MockServletRequest request = new MockServletRequest(); 52 request.setRequestURI("/app"); 53 MockFilterChain filterChain = new MockFilterChain(); 54 applicationFilter.doFilter(request, new MockServletResponse(), filterChain); 55 56 filterChain.assertExecuted(); 57 58 applicationFilter.destroy(); 59 } 60 }

This page was automatically generated by Maven