You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ben Morgan <fo...@gmail.com> on 2007/05/17 17:47:53 UTC

Re: Struts 2 and Validation Testing


k hall wrote:
> 
> I really like Struts 2 but has anyone had any success in testing Struts
> 2's action validation logic?
> 

I also really like Struts2 and have been suffering the same irritation with
testing validation logic.

Having spent a while stepping through the code, it appears that the problem
stems from the fact that there isn't a configured object factory for the
test, which results in a NullPointerException. I've solved this using the
following code :

		ObjectFactory.setObjectFactory( new ObjectFactory() );

Hope this helps.

Ben
-- 
View this message in context: http://www.nabble.com/Struts-2-and-Validation-Testing-tf3451623.html#a10666757
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 and Validation Testing

Posted by "daniel H." <da...@gmail.com>.
Thanks.

I did get the same error with Struts 2.0.6 and Junit 4.0. After adding the
statement of ObjectFactory in setUpBeforeClass, it works. 

Daniel H.


Ben Morgan wrote:
> 
> 
> k hall wrote:
>> 
>> I really like Struts 2 but has anyone had any success in testing Struts
>> 2's action validation logic?
>> 
> 
> I also really like Struts2 and have been suffering the same irritation
> with testing validation logic.
> 
> Having spent a while stepping through the code, it appears that the
> problem stems from the fact that there isn't a configured object factory
> for the test, which results in a NullPointerException. I've solved this
> using the following code :
> 
> 		ObjectFactory.setObjectFactory( new ObjectFactory() );
> 
> Hope this helps.
> 
> Ben
> 

-- 
View this message in context: http://www.nabble.com/Struts-2-and-Validation-Testing-tf3451623.html#a11628613
Sent from the Struts - User mailing list archive at Nabble.com.