You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Thomas Ferris Nicolaisen (JIRA)" <ji...@apache.org> on 2007/04/09 02:41:51 UTC

[jira] Updated: (WW-1868) Struts 2 validation testing fails because ObjectFactory is null

     [ https://issues.apache.org/struts/browse/WW-1868?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Ferris Nicolaisen updated WW-1868:
-----------------------------------------

    Attachment: TestValidation.patch

Attached a testcase that demonstrates the example from the wiki-link above.

As stated, the test-case works if StrutsTestcase or XWorkTestCase is extended. 

I don't know whether it is an issue that we are dependant on StrutsTestCase for doing validation testing, but I end up with an NPE when running the StrutsTestCase.setup method in my own code because of dependance to the Spring objectFactory not being set in this test-case. I tried replacing the strutsSpringObjectFactory with my own subclass of SpringProxyableObjectFactory that overrides with a manual applicationContext lookup, but the SpringObjectFactory attempts to use appContext before getApplicationContext has been called. 

Anyhow, I'm sure the spring-integration with StrutsTestCase has been raised somewhere else, just a bit too tired to figure out right now.

But the issue remains: Validation unit tests depend on StrutsTestCase. Is this a wontfix?

> Struts 2 validation testing fails because ObjectFactory is null
> ---------------------------------------------------------------
>
>                 Key: WW-1868
>                 URL: https://issues.apache.org/struts/browse/WW-1868
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.6
>            Reporter: Rich Thornett
>         Attachments: TestValidation.patch
>
>
> Recenly upgraded from Struts 2.0.1 to Struts 2.0.6 and my unit tests of Struts2 validation now fail.  Unit tests followed the pattern described here:
> http://struts.apache.org/2.x/docs/how-do-i-unit-test-my-actions-validation-logic.html
> The issue has been noticed by others and is described in more detail here:
> http://www.nabble.com/Struts-2-and-Validation-Testing-t3451623.html
> Core problem seems to be that ObjectFactory is not getting set by the time it is referenced in
> ValidatorFileParser.parseValidatorDefinitions()  // xwork-2.0.1

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.