org.apache.struts.action
Class TestActionServlet

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.struts.action.TestActionServlet
All Implemented Interfaces:
junit.framework.Test

public class TestActionServlet
extends junit.framework.TestCase

Suite of unit tests for the org.apache.struts.action.ActionServlet class.


Nested Class Summary
static class TestActionServlet.CustomActionConfig
          Used for testing custom ActionConfig classes.
static class TestActionServlet.CustomExceptionConfig
          Used for testing custom ExceptionConfig classes.
static class TestActionServlet.CustomFormBeanConfig
          Used for testing custom FormBeanConfig classes.
static class TestActionServlet.CustomForwardConfig
          Used for testing custom ForwardConfig classes.
 
Field Summary
protected  ActionServlet actionServlet
          The ActionServlet we'll test.
protected  ActionMapping baseAction
          The common action config we'll use.
protected  ExceptionConfig baseException
          The common exception config we'll use.
protected  FormBeanConfig baseFormBean
          The common form bean we'll use.
protected  ActionForward baseForward
          The common action forward we'll use.
protected  ModuleConfig moduleConfig
          The ModuleConfig we'll use.
 
Constructor Summary
TestActionServlet(String theName)
          Defines the testcase name for JUnit.
 
Method Summary
static void main(String[] theArgs)
          Start the tests.
 void notestProcessActionConfigClassError()
          Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.
 void notestProcessExceptionConfigClassError()
          Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.
 void notestProcessFormBeanConfigClassError()
          Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.
 void notestProcessForwardConfigClassError()
          Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.
 void notestSplitAndResolvePaths()
          Test class loader resolution and splitting.
 void setUp()
          Set up instance variables required by this test case.
static junit.framework.Test suite()
           
 void tearDown()
          Tear down instance variables required by this test case.
 void testInitDestroyInternal()
          Verify that we can initialize and destroy our internal message resources object.
 void testInitModuleActionConfigsNoExtends()
          Test that nothing fails if there are no extensions.
 void testInitModuleExceptionConfigsNoExtends()
          Test that nothing fails if there are no extensions.
 void testInitModuleExceptionConfigsNullFormType()
          Test that initModuleExceptionConfigs throws an exception when a handler with a null key is present.
 void testInitModuleFormBeansNoExtends()
          Test that nothing fails if there are no extensions.
 void testInitModuleFormBeansNullFormType()
          Test that initModuleFormBeans throws an exception when a form with a null type is present.
 void testInitModuleFormBeansNullPropType()
          Test that initModuleFormBeans throws an exception when a form whose prop type is null is present.
 void testInitModuleForwardConfigsNoExtends()
          Test that nothing fails if there are no extensions.
 void testInitModuleForwardsNullFormType()
          Test that initModuleForwards throws an exception when a forward with a null path is present.
 void testProcessActionConfigClass()
          Make sure processActionConfigClass() returns an instance of the correct class if the base config is using a custom class.
 void testProcessActionConfigClassNoExtends()
          Make sure processActionConfigClass() returns what it was given if the action passed to it doesn't extend anything.
 void testProcessActionConfigClassOverriddenSubConfigClass()
          Test the case where the subconfig has already specified its own config class.
 void testProcessActionConfigClassSubConfigCustomClass()
          Make sure processActionConfigClass() returns the same class instance if the base config isn't using a custom class.
 void testProcessActionExtension()
          Test that processActionConfigExtension() calls processExtends()
 void testProcessActionExtensionWithExceptionConfig()
          Test that an ActionConfig's ExceptionConfig can inherit from a global ExceptionConfig.
 void testProcessActionExtensionWithForwardConfig()
          Test that an ActionConfig's ForwardConfig can inherit from a global ForwardConfig.
 void testProcessExceptionConfigClass()
          Make sure processExceptionConfigClass() returns an instance of the correct class if the base config is using a custom class.
 void testProcessExceptionConfigClassNoExtends()
          Make sure processExceptionConfigClass() returns what it was given if the handler passed to it doesn't extend anything.
 void testProcessExceptionConfigClassOverriddenSubFormClass()
          Test the case where the subconfig has already specified its own config class.
 void testProcessExceptionConfigClassSubConfigCustomClass()
          Make sure processExceptionConfigClass() returns the same class instance if the base config isn't using a custom class.
 void testProcessExceptionExtension()
          Test that processExceptionExtension() calls processExtends()
 void testProcessFormBeanConfigClass()
          Make sure processFormBeanConfigClass() returns an instance of the correct class if the base config is using a custom class.
 void testProcessFormBeanConfigClassNoExtends()
          Make sure processFormBeanConfigClass() returns what it was given if the form passed to it doesn't extend anything.
 void testProcessFormBeanConfigClassOverriddenSubFormClass()
          Test the case where the subform has already specified its own form bean config class.
 void testProcessFormBeanConfigClassSubFormCustomClass()
          Make sure processFormBeanConfigClass() returns the same class instance if the base config isn't using a custom class.
 void testProcessFormBeanExtension()
          Test that processFormBeanExtension() calls processExtends()
 void testProcessForwardConfigClass()
          Make sure processForwardConfigClass() returns an instance of the correct class if the base config is using a custom class.
 void testProcessForwardConfigClassNoExtends()
          Make sure processForwardConfigClass() returns what it was given if the forward passed to it doesn't extend anything.
 void testProcessForwardConfigClassOverriddenSubConfigClass()
          Test the case where the subconfig has already specified its own config class.
 void testProcessForwardConfigClassSubConfigCustomClass()
          Make sure processForwardConfigClass() returns the same class instance if the base config isn't using a custom class.
 void testProcessForwardExtension()
          Test that processForwardExtension() calls processExtends()
 
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
 

Field Detail

moduleConfig

protected ModuleConfig moduleConfig
The ModuleConfig we'll use.


baseFormBean

protected FormBeanConfig baseFormBean
The common form bean we'll use.


baseException

protected ExceptionConfig baseException
The common exception config we'll use.


baseAction

protected ActionMapping baseAction
The common action config we'll use.


baseForward

protected ActionForward baseForward
The common action forward we'll use.


actionServlet

protected ActionServlet actionServlet
The ActionServlet we'll test.

Constructor Detail

TestActionServlet

public TestActionServlet(String theName)
Defines the testcase name for JUnit.

Parameters:
theName - the testcase's name.
Method Detail

main

public static void main(String[] theArgs)
Start the tests.

Parameters:
theArgs - the arguments. Not used

suite

public static junit.framework.Test suite()
Returns:
a test suite (TestSuite) that includes all methods starting with "test"

setUp

public void setUp()
           throws Exception
Set up instance variables required by this test case.

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

tearDown

public void tearDown()
Tear down instance variables required by this test case.

Overrides:
tearDown in class junit.framework.TestCase

testInitDestroyInternal

public void testInitDestroyInternal()
Verify that we can initialize and destroy our internal message resources object.


notestSplitAndResolvePaths

public void notestSplitAndResolvePaths()
                                throws Exception
Test class loader resolution and splitting.

Throws:
Exception

testInitModuleFormBeansNoExtends

public void testInitModuleFormBeansNoExtends()
                                      throws javax.servlet.ServletException
Test that nothing fails if there are no extensions.

Throws:
javax.servlet.ServletException

testInitModuleFormBeansNullFormType

public void testInitModuleFormBeansNullFormType()
                                         throws javax.servlet.ServletException
Test that initModuleFormBeans throws an exception when a form with a null type is present.

Throws:
javax.servlet.ServletException

testInitModuleFormBeansNullPropType

public void testInitModuleFormBeansNullPropType()
                                         throws javax.servlet.ServletException
Test that initModuleFormBeans throws an exception when a form whose prop type is null is present.

Throws:
javax.servlet.ServletException

testProcessFormBeanExtension

public void testProcessFormBeanExtension()
                                  throws javax.servlet.ServletException
Test that processFormBeanExtension() calls processExtends()

Throws:
javax.servlet.ServletException

testProcessFormBeanConfigClass

public void testProcessFormBeanConfigClass()
                                    throws Exception
Make sure processFormBeanConfigClass() returns an instance of the correct class if the base config is using a custom class.

Throws:
Exception

testProcessFormBeanConfigClassNoExtends

public void testProcessFormBeanConfigClassNoExtends()
                                             throws Exception
Make sure processFormBeanConfigClass() returns what it was given if the form passed to it doesn't extend anything.

Throws:
Exception

testProcessFormBeanConfigClassSubFormCustomClass

public void testProcessFormBeanConfigClassSubFormCustomClass()
                                                      throws Exception
Make sure processFormBeanConfigClass() returns the same class instance if the base config isn't using a custom class.

Throws:
Exception

notestProcessFormBeanConfigClassError

public void notestProcessFormBeanConfigClassError()
                                           throws Exception
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.

Throws:
Exception

testProcessFormBeanConfigClassOverriddenSubFormClass

public void testProcessFormBeanConfigClassOverriddenSubFormClass()
                                                          throws Exception
Test the case where the subform has already specified its own form bean config class. If the code still attempts to create a new instance, an error will be thrown.

Throws:
Exception

testInitModuleExceptionConfigsNoExtends

public void testInitModuleExceptionConfigsNoExtends()
                                             throws javax.servlet.ServletException
Test that nothing fails if there are no extensions.

Throws:
javax.servlet.ServletException

testInitModuleExceptionConfigsNullFormType

public void testInitModuleExceptionConfigsNullFormType()
                                                throws javax.servlet.ServletException
Test that initModuleExceptionConfigs throws an exception when a handler with a null key is present.

Throws:
javax.servlet.ServletException

testProcessExceptionExtension

public void testProcessExceptionExtension()
                                   throws javax.servlet.ServletException
Test that processExceptionExtension() calls processExtends()

Throws:
javax.servlet.ServletException

testProcessExceptionConfigClass

public void testProcessExceptionConfigClass()
                                     throws Exception
Make sure processExceptionConfigClass() returns an instance of the correct class if the base config is using a custom class.

Throws:
Exception

testProcessExceptionConfigClassNoExtends

public void testProcessExceptionConfigClassNoExtends()
                                              throws Exception
Make sure processExceptionConfigClass() returns what it was given if the handler passed to it doesn't extend anything.

Throws:
Exception

testProcessExceptionConfigClassSubConfigCustomClass

public void testProcessExceptionConfigClassSubConfigCustomClass()
                                                         throws Exception
Make sure processExceptionConfigClass() returns the same class instance if the base config isn't using a custom class.

Throws:
Exception

notestProcessExceptionConfigClassError

public void notestProcessExceptionConfigClassError()
                                            throws Exception
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.

Throws:
Exception

testProcessExceptionConfigClassOverriddenSubFormClass

public void testProcessExceptionConfigClassOverriddenSubFormClass()
                                                           throws Exception
Test the case where the subconfig has already specified its own config class. If the code still attempts to create a new instance, an error will be thrown.

Throws:
Exception

testInitModuleForwardConfigsNoExtends

public void testInitModuleForwardConfigsNoExtends()
                                           throws javax.servlet.ServletException
Test that nothing fails if there are no extensions.

Throws:
javax.servlet.ServletException

testInitModuleForwardsNullFormType

public void testInitModuleForwardsNullFormType()
                                        throws javax.servlet.ServletException
Test that initModuleForwards throws an exception when a forward with a null path is present.

Throws:
javax.servlet.ServletException

testProcessForwardExtension

public void testProcessForwardExtension()
                                 throws javax.servlet.ServletException
Test that processForwardExtension() calls processExtends()

Throws:
javax.servlet.ServletException

testProcessForwardConfigClass

public void testProcessForwardConfigClass()
                                   throws Exception
Make sure processForwardConfigClass() returns an instance of the correct class if the base config is using a custom class.

Throws:
Exception

testProcessForwardConfigClassNoExtends

public void testProcessForwardConfigClassNoExtends()
                                            throws Exception
Make sure processForwardConfigClass() returns what it was given if the forward passed to it doesn't extend anything.

Throws:
Exception

testProcessForwardConfigClassSubConfigCustomClass

public void testProcessForwardConfigClassSubConfigCustomClass()
                                                       throws Exception
Make sure processForwardConfigClass() returns the same class instance if the base config isn't using a custom class.

Throws:
Exception

notestProcessForwardConfigClassError

public void notestProcessForwardConfigClassError()
                                          throws Exception
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.

Throws:
Exception

testProcessForwardConfigClassOverriddenSubConfigClass

public void testProcessForwardConfigClassOverriddenSubConfigClass()
                                                           throws Exception
Test the case where the subconfig has already specified its own config class. If the code still attempts to create a new instance, an error will be thrown.

Throws:
Exception

testInitModuleActionConfigsNoExtends

public void testInitModuleActionConfigsNoExtends()
                                          throws javax.servlet.ServletException
Test that nothing fails if there are no extensions.

Throws:
javax.servlet.ServletException

testProcessActionExtension

public void testProcessActionExtension()
                                throws javax.servlet.ServletException
Test that processActionConfigExtension() calls processExtends()

Throws:
javax.servlet.ServletException

testProcessActionExtensionWithForwardConfig

public void testProcessActionExtensionWithForwardConfig()
                                                 throws javax.servlet.ServletException
Test that an ActionConfig's ForwardConfig can inherit from a global ForwardConfig.

Throws:
javax.servlet.ServletException

testProcessActionExtensionWithExceptionConfig

public void testProcessActionExtensionWithExceptionConfig()
                                                   throws javax.servlet.ServletException
Test that an ActionConfig's ExceptionConfig can inherit from a global ExceptionConfig.

Throws:
javax.servlet.ServletException

testProcessActionConfigClass

public void testProcessActionConfigClass()
                                  throws Exception
Make sure processActionConfigClass() returns an instance of the correct class if the base config is using a custom class.

Throws:
Exception

testProcessActionConfigClassNoExtends

public void testProcessActionConfigClassNoExtends()
                                           throws Exception
Make sure processActionConfigClass() returns what it was given if the action passed to it doesn't extend anything.

Throws:
Exception

testProcessActionConfigClassSubConfigCustomClass

public void testProcessActionConfigClassSubConfigCustomClass()
                                                      throws Exception
Make sure processActionConfigClass() returns the same class instance if the base config isn't using a custom class.

Throws:
Exception

notestProcessActionConfigClassError

public void notestProcessActionConfigClassError()
                                         throws Exception
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.

Throws:
Exception

testProcessActionConfigClassOverriddenSubConfigClass

public void testProcessActionConfigClassOverriddenSubConfigClass()
                                                          throws Exception
Test the case where the subconfig has already specified its own config class. If the code still attempts to create a new instance, an error will be thrown.

Throws:
Exception


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.