FileDocCategorySizeDatePackage
TestConfigParamServlet.javaAPI DocExample1518Sat Mar 15 19:39:50 GMT 2003com.oreilly.javaxp.cactus.servlet

TestConfigParamServlet

public class TestConfigParamServlet extends org.apache.cactus.ServletTestCase
author
Brian M. Coyner $version $Id: TestConfigParamServlet.java,v 1.2 2003/02/27 00:24:44 jepc Exp $

Fields Summary
private ConfigParamServlet
servlet
Constructors Summary
public TestConfigParamServlet(String name)

        super(name);
    
Methods Summary
public voidsetUp()

        this.servlet = new ConfigParamServlet();
    
public voidtestInvalidInitParameterValues()

        this.config.setInitParameter(ConfigParamServlet.CONFIG_PARAM, "JUNK");
        this.servlet.init(this.config);
        assertTrue("Invalid Init Parameter.",
                   !this.servlet.validateInitParameters());
    
public voidtestValidInitParameters()


        // the config object is instantiated by the Servlet Redirector
        // Servlet.  Our test case is given access to this object
        // implicitly by the Cactus framework.  A very important step
        // is to initialize our servlet being tested with this config
        // object (ServletConfig) as shown below!
        this.config.setInitParameter(ConfigParamServlet.CONFIG_PARAM,
                                     ConfigParamServlet.CONFIG_VALUE);

        // critical step!
        this.servlet.init(this.config);
        assertTrue("Valid Init Parameter.",
                   this.servlet.validateInitParameters());