I have a Spring Webflow 2.4 app, with a view-state such as this:
<view-state id="family-size" model="additionalSupporters" validation-hints="'familyGroupSize'">
<transition on="continue" to="enter-lead-details"/>
</view-state>
All validation is using validation hints as introduced in Spring Webflow 2.4 (http://ift.tt/1Neud99)
I am testing my flows by extending Spring's AbstractXmlFlowExecutionTests, and I have written a nice collection of tests that essentially all test the happy path (ie. where validation has passed). I'm assuming these tests are passing validation by virtue of the fact that my tests do not setup any specific state or behaviour for validation, so presumably the default state is to pass?
What I would like to do is test happy and sad paths through the view-state based on whether the validation passes or fails.
The model pojo looks a bit like this:
public class AdditionalSupportersForm {
public interface FamilyGroupSize {
}
@Min(0)
@Max(3)
private Integer numAdditionalAdults;
where the familyGroupSize reference in the validation-hints attribute is the inner class of the model pojo class.
At runtime this all works fine, but as mentioned, I would like to test it in my flow tests.
Does anyone know how to mock the validator or validator context (I'm assuming that's what I need to mock) so that I can write tests that pass validation, and others that fail? (I'm using mockito btw)
Thanks Nathan
Aucun commentaire:
Enregistrer un commentaire