Package org.apache.struts.action
Class TestActionServlet
java.lang.Object
org.apache.struts.action.TestActionServlet
Suite of unit tests for the
ActionServlet
class.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Used for testing custom ActionConfig classes.static class
Used for testing custom ExceptionConfig classes.static class
Used for testing custom FormBeanConfig classes.static class
Used for testing custom ForwardConfig classes. -
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.struts.action.ActionServlet
The ActionServlet we'll test.protected org.apache.struts.action.ActionMapping
The common action config we'll use.protected org.apache.struts.config.ExceptionConfig
The common exception config we'll use.protected org.apache.struts.config.FormBeanConfig
The common form bean we'll use.protected org.apache.struts.action.ActionForward
The common action forward we'll use.protected org.apache.struts.config.ModuleConfig
The ModuleConfig we'll use. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.void
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.void
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.void
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class.void
Test class loader resolution and splitting.void
setUp()
Set up instance variables required by this test case.void
tearDown()
Tear down instance variables required by this test case.void
Verify that we can initialize and destroy our internal message resources object.void
Test that nothing fails if there are no extensions.void
Test that nothing fails if there are no extensions.void
Test that initModuleExceptionConfigs does not throw an exception when a handler with a null key is present.void
Test that nothing fails if there are no extensions.void
Test that initModuleFormBeans throws an exception when a form with a null type is present.void
Test that initModuleFormBeans throws an exception when a form whose prop type is null is present.void
Test that nothing fails if there are no extensions.void
Test that initModuleForwards throws an exception when a forward with a null path is present.void
Make sure processActionConfigClass() returns an instance of the correct class if the base config is using a custom class.void
Make sure processActionConfigClass() returns what it was given if the action passed to it doesn't extend anything.void
Test the case where the subconfig has already specified its own config class.void
Make sure processActionConfigClass() returns the same class instance if the base config isn't using a custom class.void
Test that processActionConfigExtension() calls processExtends()void
Test that an ActionConfig's ExceptionConfig can inherit from a global ExceptionConfig.void
Test that an ActionConfig's ForwardConfig can inherit from a global ForwardConfig.void
Make sure processExceptionConfigClass() returns an instance of the correct class if the base config is using a custom class.void
Make sure processExceptionConfigClass() returns what it was given if the handler passed to it doesn't extend anything.void
Test the case where the subconfig has already specified its own config class.void
Make sure processExceptionConfigClass() returns the same class instance if the base config isn't using a custom class.void
Test that processExceptionExtension() calls processExtends()void
Make sure processFormBeanConfigClass() returns an instance of the correct class if the base config is using a custom class.void
Make sure processFormBeanConfigClass() returns what it was given if the form passed to it doesn't extend anything.void
Test the case where the subform has already specified its own form bean config class.void
Make sure processFormBeanConfigClass() returns the same class instance if the base config isn't using a custom class.void
Test that processFormBeanExtension() calls processExtends()void
Make sure processForwardConfigClass() returns an instance of the correct class if the base config is using a custom class.void
Make sure processForwardConfigClass() returns what it was given if the forward passed to it doesn't extend anything.void
Test the case where the subconfig has already specified its own config class.void
Make sure processForwardConfigClass() returns the same class instance if the base config isn't using a custom class.void
Test that processForwardExtension() calls processExtends()
-
Field Details
-
moduleConfig
protected org.apache.struts.config.ModuleConfig moduleConfigThe ModuleConfig we'll use. -
baseFormBean
protected org.apache.struts.config.FormBeanConfig baseFormBeanThe common form bean we'll use. -
baseException
protected org.apache.struts.config.ExceptionConfig baseExceptionThe common exception config we'll use. -
baseAction
protected org.apache.struts.action.ActionMapping baseActionThe common action config we'll use. -
baseForward
protected org.apache.struts.action.ActionForward baseForwardThe common action forward we'll use. -
actionServlet
protected org.apache.struts.action.ActionServlet actionServletThe ActionServlet we'll test.
-
-
Constructor Details
-
TestActionServlet
public TestActionServlet()
-
-
Method Details
-
setUp
Set up instance variables required by this test case.- Throws:
ServletException
- if we cannot initialize these resources
-
tearDown
Tear down instance variables required by this test case. -
testInitDestroyInternal
Verify that we can initialize and destroy our internal message resources object. -
notestSplitAndResolvePaths
Test class loader resolution and splitting.- Throws:
ServletException
- if a servlet exception is thrown
-
testInitModuleFormBeansNoExtends
Test that nothing fails if there are no extensions. -
testInitModuleFormBeansNullFormType
Test that initModuleFormBeans throws an exception when a form with a null type is present. -
testInitModuleFormBeansNullPropType
Test that initModuleFormBeans throws an exception when a form whose prop type is null is present. -
testProcessFormBeanExtension
Test that processFormBeanExtension() calls processExtends()- Throws:
ServletException
-
testProcessFormBeanConfigClass
Make sure processFormBeanConfigClass() returns an instance of the correct class if the base config is using a custom class.- Throws:
ServletException
- if a servlet exception is thrown
-
testProcessFormBeanConfigClassNoExtends
Make sure processFormBeanConfigClass() returns what it was given if the form passed to it doesn't extend anything.- Throws:
ServletException
- if a servlet exception is thrown
-
testProcessFormBeanConfigClassSubFormCustomClass
Make sure processFormBeanConfigClass() returns the same class instance if the base config isn't using a custom class.- Throws:
ServletException
- if a servlet exception is thrown
-
notestProcessFormBeanConfigClassError
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class. -
testProcessFormBeanConfigClassOverriddenSubFormClass
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. -
testInitModuleExceptionConfigsNoExtends
Test that nothing fails if there are no extensions. -
testInitModuleExceptionConfigsNullFormType
Test that initModuleExceptionConfigs does not throw an exception when a handler with a null key is present. -
testProcessExceptionExtension
Test that processExceptionExtension() calls processExtends()- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessExceptionConfigClass
Make sure processExceptionConfigClass() returns an instance of the correct class if the base config is using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessExceptionConfigClassNoExtends
Make sure processExceptionConfigClass() returns what it was given if the handler passed to it doesn't extend anything.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessExceptionConfigClassSubConfigCustomClass
Make sure processExceptionConfigClass() returns the same class instance if the base config isn't using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
notestProcessExceptionConfigClassError
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class. -
testProcessExceptionConfigClassOverriddenSubFormClass
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. -
testInitModuleForwardConfigsNoExtends
Test that nothing fails if there are no extensions. -
testInitModuleForwardsNullFormType
Test that initModuleForwards throws an exception when a forward with a null path is present. -
testProcessForwardExtension
Test that processForwardExtension() calls processExtends()- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessForwardConfigClass
Make sure processForwardConfigClass() returns an instance of the correct class if the base config is using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessForwardConfigClassNoExtends
Make sure processForwardConfigClass() returns what it was given if the forward passed to it doesn't extend anything.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessForwardConfigClassSubConfigCustomClass
Make sure processForwardConfigClass() returns the same class instance if the base config isn't using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
notestProcessForwardConfigClassError
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class. -
testProcessForwardConfigClassOverriddenSubConfigClass
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. -
testInitModuleActionConfigsNoExtends
Test that nothing fails if there are no extensions. -
testProcessActionExtension
Test that processActionConfigExtension() calls processExtends()- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessActionExtensionWithForwardConfig
Test that an ActionConfig's ForwardConfig can inherit from a global ForwardConfig.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessActionExtensionWithExceptionConfig
Test that an ActionConfig's ExceptionConfig can inherit from a global ExceptionConfig.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessActionConfigClass
Make sure processActionConfigClass() returns an instance of the correct class if the base config is using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessActionConfigClassNoExtends
Make sure processActionConfigClass() returns what it was given if the action passed to it doesn't extend anything.- Throws:
ServletException
- if initialization cannot be performed.
-
testProcessActionConfigClassSubConfigCustomClass
Make sure processActionConfigClass() returns the same class instance if the base config isn't using a custom class.- Throws:
ServletException
- if initialization cannot be performed.
-
notestProcessActionConfigClassError
Make sure the code throws the correct exception when it can't create an instance of the base config's custom class. -
testProcessActionConfigClassOverriddenSubConfigClass
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.
-