com.mockrunner.servlet
Class BasicServletTestCaseAdapter

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.mockrunner.base.BasicWebTestCase
              extended by com.mockrunner.base.BasicHTMLOutputTestCase
                  extended by com.mockrunner.servlet.BasicServletTestCaseAdapter
All Implemented Interfaces:
junit.framework.Test

public abstract class BasicServletTestCaseAdapter
extends BasicHTMLOutputTestCase

Delegator for ServletTestModule. You can subclass this adapter or use ServletTestModule directly (so your test case can use another base class). This basic adapter can be used if you don't need any other modules. It does not extend BaseTestCase. If you want to use several modules in conjunction, consider subclassing ServletTestCaseAdapter. This class is generated from the ServletTestModule and should not be edited directly.


Constructor Summary
BasicServletTestCaseAdapter()
           
BasicServletTestCaseAdapter(java.lang.String name)
           
 
Method Summary
protected  void addFilter(javax.servlet.Filter filter)
          Delegates to ServletTestModule.addFilter(Filter)
protected  void addFilter(javax.servlet.Filter filter, boolean doInit)
          Delegates to ServletTestModule.addFilter(Filter, boolean)
protected  void clearOutput()
          Delegates to ServletTestModule.clearOutput()
protected  javax.servlet.Filter createFilter(java.lang.Class filterClass)
          Delegates to ServletTestModule.createFilter(Class)
protected  javax.servlet.http.HttpServlet createServlet(java.lang.Class servletClass)
          Delegates to ServletTestModule.createServlet(Class)
protected  ServletTestModule createServletTestModule()
          Creates a ServletTestModule based on the current WebMockObjectFactory.
protected  ServletTestModule createServletTestModule(WebMockObjectFactory mockFactory)
          Creates a ServletTestModule with the specified WebMockObjectFactory.
protected  WebMockObjectFactory createWebMockObjectFactory()
          Creates a WebMockObjectFactory.
protected  WebMockObjectFactory createWebMockObjectFactory(WebMockObjectFactory otherFactory)
          Same as createWebMockObjectFactory(otherFactory, true).
protected  WebMockObjectFactory createWebMockObjectFactory(WebMockObjectFactory otherFactory, boolean createNewSession)
          Creates a WebMockObjectFactory based on another WebMockObjectFactory.
protected  void doDelete()
          Delegates to ServletTestModule.doDelete()
protected  void doFilter()
          Delegates to ServletTestModule.doFilter()
protected  void doGet()
          Delegates to ServletTestModule.doGet()
protected  void doHead()
          Delegates to ServletTestModule.doHead()
protected  void doOptions()
          Delegates to ServletTestModule.doOptions()
protected  void doPost()
          Delegates to ServletTestModule.doPost()
protected  void doPut()
          Delegates to ServletTestModule.doPut()
protected  void doTrace()
          Delegates to ServletTestModule.doTrace()
protected  javax.servlet.ServletRequest getFilteredRequest()
          Delegates to ServletTestModule.getFilteredRequest()
protected  javax.servlet.ServletResponse getFilteredResponse()
          Delegates to ServletTestModule.getFilteredResponse()
protected  HTMLOutputModule getHTMLOutputModule()
          Returns the ServletTestModule as HTMLOutputModule.
protected  javax.servlet.http.HttpServlet getServlet()
          Delegates to ServletTestModule.getServlet()
protected  ServletTestModule getServletTestModule()
          Gets the ServletTestModule.
protected  WebMockObjectFactory getWebMockObjectFactory()
          Gets the WebMockObjectFactory.
protected  void init()
          Delegates to ServletTestModule.init()
protected  void releaseFilters()
          Delegates to ServletTestModule.releaseFilters()
protected  void service()
          Delegates to ServletTestModule.service()
protected  void setDoChain(boolean doChain)
          Delegates to ServletTestModule.setDoChain(boolean)
protected  void setServlet(javax.servlet.http.HttpServlet servlet)
          Delegates to ServletTestModule.setServlet(HttpServlet)
protected  void setServlet(javax.servlet.http.HttpServlet servlet, boolean doInit)
          Delegates to ServletTestModule.setServlet(HttpServlet, boolean)
protected  void setServletTestModule(ServletTestModule servletTestModule)
          Sets the ServletTestModule.
protected  void setUp()
          Creates the ServletTestModule.
protected  void setWebMockObjectFactory(WebMockObjectFactory webMockObjectFactory)
          Sets the WebMockObjectFactory.
protected  void tearDown()
           
 
Methods inherited from class com.mockrunner.base.BasicHTMLOutputTestCase
getOutput, getOutputAsBufferedReader, getOutputAsJDOMDocument, getOutputAsW3CDocument, getOutputAsWellformedXML, getWebTestModule, setCaseSensitive, verifyOutput, verifyOutputContains, verifyOutputRegularExpression
 
Methods inherited from class com.mockrunner.base.BasicWebTestCase
addRequestParameter, addRequestParameter, addRequestParameter, getRequestAttribute, getRequestParameter, getSessionAttribute, setRequestAttribute, setSessionAttribute
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicServletTestCaseAdapter

public BasicServletTestCaseAdapter()

BasicServletTestCaseAdapter

public BasicServletTestCaseAdapter(java.lang.String name)
Method Detail

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

setUp

protected void setUp()
              throws java.lang.Exception
Creates the ServletTestModule. If you overwrite this method, you must call super.setUp().

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

createWebMockObjectFactory

protected WebMockObjectFactory createWebMockObjectFactory()
Creates a WebMockObjectFactory.

Returns:
the created WebMockObjectFactory

createWebMockObjectFactory

protected WebMockObjectFactory createWebMockObjectFactory(WebMockObjectFactory otherFactory)
Same as createWebMockObjectFactory(otherFactory, true).


createWebMockObjectFactory

protected WebMockObjectFactory createWebMockObjectFactory(WebMockObjectFactory otherFactory,
                                                          boolean createNewSession)
Creates a WebMockObjectFactory based on another WebMockObjectFactory. The created WebMockObjectFactory will have its own request and response objects. If you set createNewSession to true it will also have its own session object. The two factories will share one ServletContext. Especially important for multithreading tests. If you set createNewSession to false, the two factories will share one session. This setting simulates multiple requests from the same client.

Parameters:
otherFactory - the other factory
createNewSession - create a new session for the new factory
Returns:
the created WebMockObjectFactory

getWebMockObjectFactory

protected WebMockObjectFactory getWebMockObjectFactory()
Gets the WebMockObjectFactory.

Returns:
the WebMockObjectFactory

setWebMockObjectFactory

protected void setWebMockObjectFactory(WebMockObjectFactory webMockObjectFactory)
Sets the WebMockObjectFactory.

Parameters:
webMockObjectFactory - the WebMockObjectFactory

createServletTestModule

protected ServletTestModule createServletTestModule()
Creates a ServletTestModule based on the current WebMockObjectFactory. Same as createServletTestModule(getWebMockObjectFactory()).

Returns:
the created ServletTestModule

createServletTestModule

protected ServletTestModule createServletTestModule(WebMockObjectFactory mockFactory)
Creates a ServletTestModule with the specified WebMockObjectFactory.

Returns:
the created ServletTestModule

getHTMLOutputModule

protected HTMLOutputModule getHTMLOutputModule()
Returns the ServletTestModule as HTMLOutputModule.

Specified by:
getHTMLOutputModule in class BasicHTMLOutputTestCase
Returns:
the HTMLOutputModule

getServletTestModule

protected ServletTestModule getServletTestModule()
Gets the ServletTestModule.

Returns:
the ServletTestModule

setServletTestModule

protected void setServletTestModule(ServletTestModule servletTestModule)
Sets the ServletTestModule.

Parameters:
servletTestModule - the ServletTestModule

setServlet

protected void setServlet(javax.servlet.http.HttpServlet servlet)
Delegates to ServletTestModule.setServlet(HttpServlet)


setServlet

protected void setServlet(javax.servlet.http.HttpServlet servlet,
                          boolean doInit)
Delegates to ServletTestModule.setServlet(HttpServlet, boolean)


doGet

protected void doGet()
Delegates to ServletTestModule.doGet()


doPost

protected void doPost()
Delegates to ServletTestModule.doPost()


doHead

protected void doHead()
Delegates to ServletTestModule.doHead()


doPut

protected void doPut()
Delegates to ServletTestModule.doPut()


doDelete

protected void doDelete()
Delegates to ServletTestModule.doDelete()


doOptions

protected void doOptions()
Delegates to ServletTestModule.doOptions()


doTrace

protected void doTrace()
Delegates to ServletTestModule.doTrace()


getServlet

protected javax.servlet.http.HttpServlet getServlet()
Delegates to ServletTestModule.getServlet()


createServlet

protected javax.servlet.http.HttpServlet createServlet(java.lang.Class servletClass)
Delegates to ServletTestModule.createServlet(Class)


createFilter

protected javax.servlet.Filter createFilter(java.lang.Class filterClass)
Delegates to ServletTestModule.createFilter(Class)


addFilter

protected void addFilter(javax.servlet.Filter filter)
Delegates to ServletTestModule.addFilter(Filter)


addFilter

protected void addFilter(javax.servlet.Filter filter,
                         boolean doInit)
Delegates to ServletTestModule.addFilter(Filter, boolean)


releaseFilters

protected void releaseFilters()
Delegates to ServletTestModule.releaseFilters()


setDoChain

protected void setDoChain(boolean doChain)
Delegates to ServletTestModule.setDoChain(boolean)


doFilter

protected void doFilter()
Delegates to ServletTestModule.doFilter()


getFilteredRequest

protected javax.servlet.ServletRequest getFilteredRequest()
Delegates to ServletTestModule.getFilteredRequest()


getFilteredResponse

protected javax.servlet.ServletResponse getFilteredResponse()
Delegates to ServletTestModule.getFilteredResponse()


clearOutput

protected void clearOutput()
Delegates to ServletTestModule.clearOutput()


init

protected void init()
Delegates to ServletTestModule.init()


service

protected void service()
Delegates to ServletTestModule.service()