001    package com.mockrunner.base;
002    
003    /**
004     * Delegator for {@link WebTestModule}. The corresponding
005     * adapters extend this class. This class is used for the standard
006     * adapter versions, that extend {@link BaseTestCase}.
007     */
008    public abstract class WebTestCase extends BaseTestCase
009    {
010        public WebTestCase()
011        {
012    
013        }
014    
015        public WebTestCase(String arg0)
016        {
017            super(arg0);
018        }
019        
020        /**
021         * Implemented by concrete subclasses.
022         */ 
023        protected abstract WebTestModule getWebTestModule();
024        
025        /**
026         * Delegates to {@link WebTestModule#addRequestParameter(String)}
027         */
028        protected void addRequestParameter(String key)
029        {
030            getWebTestModule().addRequestParameter(key);
031        }
032    
033        /**
034         * Delegates to {@link WebTestModule#addRequestParameter(String, String)}
035         */
036        protected void addRequestParameter(String key, String value)
037        {
038            getWebTestModule().addRequestParameter(key, value);
039        }
040    
041        /**
042         * Delegates to {@link WebTestModule#addRequestParameter(String, String[])}
043         */
044        protected void addRequestParameter(String key, String[] values)
045        {
046            getWebTestModule().addRequestParameter(key, values);
047        }
048    
049        /**
050         * Delegates to {@link WebTestModule#getRequestParameter(String)}
051         */
052        protected String getRequestParameter(String key)
053        {
054            return getWebTestModule().getRequestParameter(key);
055        }
056    
057        /**
058         * Delegates to {@link WebTestModule#getRequestAttribute(String)}
059         */
060        protected Object getRequestAttribute(String key)
061        {
062            return getWebTestModule().getRequestAttribute(key);
063        }
064    
065        /**
066         * Delegates to {@link WebTestModule#setRequestAttribute(String, Object)}
067         */
068        protected void setRequestAttribute(String key, Object value)
069        {
070            getWebTestModule().setRequestAttribute(key, value);
071        }
072    
073        /**
074         * Delegates to {@link WebTestModule#setRequestAttribute(String, Object)}
075         */
076        protected Object getSessionAttribute(String key)
077        {
078            return getWebTestModule().getSessionAttribute(key);
079        }
080    
081        /**
082         * Delegates to {@link WebTestModule#setSessionAttribute(String, Object)}
083         */
084        protected void setSessionAttribute(String key, Object value)
085        {
086            getWebTestModule().setSessionAttribute(key, value);
087        }
088    }