java - In Spring Webflow unit test, how do you assert that a view state has a view of a given name? -
I am developing a spring webflow, trying to use TDD, so I have to remove the abstraction flav accession trays Has extended. I can not see a clear way of claiming what I thought that would be a simple thing: a visible state has an associated view of a given name, for example, this flow (fraction) was given:
& lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Flow ... & gt; ... & lt; View-state ID = "foo" visible = "bar view" & gt; & Lt; / Visual state & gt; & Lt; / Flow & gt; and the unit test
public award testAssetFootsthatAssuranceView () {... assertCurrentStateEquals ("foo"); GetState ("Confirmation"). IsViewState ()); // Definitely an easy way ...? ViewState ViewState = (ViewState) getFlowDefinition () GetState ("foo"); View view = viewState.getViewFactory (). GetView (new MockRequestContext ()); // Yuk! AssertTrue (.view.toString () includes ("barView")); } See the state foo on barview ?
You can use it:
AssertResponseWrittenEquals ("Barview", references); Where context is your MockExternalContext .
I always check that in such a way.
Comments
Post a Comment