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