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
Nested ClassesModifier and TypeClassDescriptionstatic classUsed for testing custom ActionConfig classes.static classUsed for testing custom ExceptionConfig classes.static classUsed for testing custom FormBeanConfig classes.static classUsed for testing custom ForwardConfig classes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.struts.action.ActionServletThe ActionServlet we'll test.protected org.apache.struts.action.ActionMappingThe common action config we'll use.protected org.apache.struts.config.ExceptionConfigThe common exception config we'll use.protected org.apache.struts.config.FormBeanConfigThe common form bean we'll use.protected org.apache.struts.action.ActionForwardThe common action forward we'll use.protected org.apache.struts.config.ModuleConfigThe ModuleConfig we'll use. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMake sure the code throws the correct exception when it can't create an instance of the base config's custom class.voidMake sure the code throws the correct exception when it can't create an instance of the base config's custom class.voidMake sure the code throws the correct exception when it can't create an instance of the base config's custom class.voidMake sure the code throws the correct exception when it can't create an instance of the base config's custom class.voidTest class loader resolution and splitting.voidsetUp()Set up instance variables required by this test case.voidtearDown()Tear down instance variables required by this test case.voidVerify that we can initialize and destroy our internal message resources object.voidTest that nothing fails if there are no extensions.voidTest that nothing fails if there are no extensions.voidTest that initModuleExceptionConfigs does not throw an exception when a handler with a null key is present.voidTest that nothing fails if there are no extensions.voidTest that initModuleFormBeans throws an exception when a form with a null type is present.voidTest that initModuleFormBeans throws an exception when a form whose prop type is null is present.voidTest that nothing fails if there are no extensions.voidTest that initModuleForwards throws an exception when a forward with a null path is present.voidMake sure processActionConfigClass() returns an instance of the correct class if the base config is using a custom class.voidMake sure processActionConfigClass() returns what it was given if the action passed to it doesn't extend anything.voidTest the case where the subconfig has already specified its own config class.voidMake sure processActionConfigClass() returns the same class instance if the base config isn't using a custom class.voidTest that processActionConfigExtension() calls processExtends()voidTest that an ActionConfig's ExceptionConfig can inherit from a global ExceptionConfig.voidTest that an ActionConfig's ForwardConfig can inherit from a global ForwardConfig.voidMake sure processExceptionConfigClass() returns an instance of the correct class if the base config is using a custom class.voidMake sure processExceptionConfigClass() returns what it was given if the handler passed to it doesn't extend anything.voidTest the case where the subconfig has already specified its own config class.voidMake sure processExceptionConfigClass() returns the same class instance if the base config isn't using a custom class.voidTest that processExceptionExtension() calls processExtends()voidMake sure processFormBeanConfigClass() returns an instance of the correct class if the base config is using a custom class.voidMake sure processFormBeanConfigClass() returns what it was given if the form passed to it doesn't extend anything.voidTest the case where the subform has already specified its own form bean config class.voidMake sure processFormBeanConfigClass() returns the same class instance if the base config isn't using a custom class.voidTest that processFormBeanExtension() calls processExtends()voidMake sure processForwardConfigClass() returns an instance of the correct class if the base config is using a custom class.voidMake sure processForwardConfigClass() returns what it was given if the forward passed to it doesn't extend anything.voidTest the case where the subconfig has already specified its own config class.voidMake sure processForwardConfigClass() returns the same class instance if the base config isn't using a custom class.voidTest 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.
-