tags:

views:

42

answers:

1

Hello,

I'm currently using Spring Webflow 2, and I've been writing a unit test for a flow before I actually write all the JSPs for the flow. For some reason, my requestParameters aren't being bound to my model object. I'm creating the model object right before I enter the view state that binds to it (rather than declaring it as a 'var' within the flow). I've double checked all the parameter names / model object properties and everything's right, but for some reason it's just not binding. Does anybody have any idea why ?

+1  A: 

Are you referring to a unit test like in Chapter 14 of the Reference? If so, the model doesn't get bound within those tests for reasons that I've not yet understood. The Spring Web Flow mocking doesn't emulate the binding portions.

See also this similar question.

Until they fix this issue, you just need to do the binding yourself in the test, setting the fields of your object to the parameters that you're setting in the flow. But it's not a very satisfying test then, I know.

Peter Cooper Jr.
Actually, yes, I'm doing a unit test where I'm trying to bind parameters to an object using SWF2's new built in model binding and validation.
Alex Marshall