[英]In Spring Webflow unit test, how do you assert that a view state has a view of a given name?
[英]How to assert in a unit test that Spring Webflow exited through the specific end state?
我正在研究Spring Webflow的單元測試方法。 正在測試的Web流具有多個結束狀態。 有沒有辦法確定,通過哪些最終狀態工作流程退出?
我目前的代碼是:
@Test
public void flow_ends_on_cancel_from_start_state() {
startFlow(context);
context.setEventId("cancel");
resumeFlow(context);
assertFlowExecutionEnded();
}
我試圖斷言當前狀態等於所討論的最終狀態的id,但斷言失敗,因為工作流已經終止。
有什么建議?
您可以使用assertFlowExecutionOutcomeEquals
來檢查,您的測試方法應該是這樣的:
@Test
public void flow_ends_on_cancel_from_start_state() {
startFlow(context);
context.setEventId("cancel");
resumeFlow(context);
assertFlowExecutionEnded();
assertFlowExecutionOutcomeEquals("endStateId");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.