Search in sources :

Example 16 with MockExternalContext

use of org.springframework.webflow.test.MockExternalContext in project head by mifos.

the class CreateSavingsAccountTest method testAnswerQuestionGroupStep_Cancel.

@Test
public void testAnswerQuestionGroupStep_Cancel() {
    setCurrentState("answerQuestionGroupStep");
    MockExternalContext context = new MockExternalContext();
    context.setEventId("cancel");
    resumeFlow(context);
    assertFlowExecutionEnded();
}
Also used : MockExternalContext(org.springframework.webflow.test.MockExternalContext) Test(org.junit.Test)

Example 17 with MockExternalContext

use of org.springframework.webflow.test.MockExternalContext in project head by mifos.

the class CreateSavingsAccountTest method testSelectCustomerStep_SearchTermEntered.

@Test
public void testSelectCustomerStep_SearchTermEntered() {
    setCurrentState("selectCustomerStep");
    MockExternalContext context = new MockExternalContext();
    context.setEventId("searchTermEntered");
    resumeFlow(context);
    verify(controller).searchCustomers(formBean);
    assertCurrentStateEquals("selectCustomerStep");
}
Also used : MockExternalContext(org.springframework.webflow.test.MockExternalContext) Test(org.junit.Test)

Example 18 with MockExternalContext

use of org.springframework.webflow.test.MockExternalContext in project head by mifos.

the class CreateSavingsAccountTest method testStartFlow_CustomerIdNotProvided.

@Test
public void testStartFlow_CustomerIdNotProvided() {
    MutableAttributeMap input = new LocalAttributeMap();
    MockExternalContext context = new MockExternalContext();
    startFlow(input, context);
    assertCurrentStateEquals("customerSearchStep");
}
Also used : LocalAttributeMap(org.springframework.webflow.core.collection.LocalAttributeMap) MockExternalContext(org.springframework.webflow.test.MockExternalContext) MutableAttributeMap(org.springframework.webflow.core.collection.MutableAttributeMap) Test(org.junit.Test)

Example 19 with MockExternalContext

use of org.springframework.webflow.test.MockExternalContext in project head by mifos.

the class CreateSavingsAccountTest method testEnterAccountDetailsStep_NewProductSelected.

@Test
public void testEnterAccountDetailsStep_NewProductSelected() {
    Integer productId = 1;
    setCurrentState("enterAccountDetailsStep");
    MockExternalContext context = new MockExternalContext();
    MockParameterMap requestParameterMap = new MockParameterMap();
    requestParameterMap.put("productId", productId.toString());
    context.setRequestParameterMap(requestParameterMap);
    context.setEventId("newProductSelected");
    resumeFlow(context);
    verify(controller).loadProduct(productId, formBean);
    assertCurrentStateEquals("enterAccountDetailsStep");
}
Also used : MockExternalContext(org.springframework.webflow.test.MockExternalContext) MockParameterMap(org.springframework.webflow.test.MockParameterMap) Test(org.junit.Test)

Example 20 with MockExternalContext

use of org.springframework.webflow.test.MockExternalContext in project head by mifos.

the class CreateSavingsAccountTest method testEnterAccountDetailsStep_DetailsEntered_WithQuestionGroup.

/**
     * Account info entry step is complete. There is a question group defined
     * for "Create Savings" work flow.
     */
@Test
public void testEnterAccountDetailsStep_DetailsEntered_WithQuestionGroup() {
    List<QuestionGroupDetail> groups = new ArrayList<QuestionGroupDetail>();
    groups.add(new QuestionGroupDetail());
    when(formBean.getQuestionGroups()).thenReturn(groups);
    setCurrentState("enterAccountDetailsStep");
    MockExternalContext context = new MockExternalContext();
    context.setEventId("detailsEntered");
    resumeFlow(context);
    assertCurrentStateEquals("answerQuestionGroupStep");
}
Also used : MockExternalContext(org.springframework.webflow.test.MockExternalContext) QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

MockExternalContext (org.springframework.webflow.test.MockExternalContext)26 Test (org.junit.Test)21 lombok.val (lombok.val)5 Test (org.junit.jupiter.api.Test)5 MockParameterMap (org.springframework.webflow.test.MockParameterMap)4 MockRequestContext (org.springframework.webflow.test.MockRequestContext)4 ArrayList (java.util.ArrayList)3 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)3 CentralAuthenticationService (org.apereo.cas.CentralAuthenticationService)2 Service (org.apereo.cas.authentication.principal.Service)2 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)2 DefaultRegisteredServiceAccessStrategy (org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy)2 GenericSuccessViewAction (org.apereo.cas.web.flow.login.GenericSuccessViewAction)2 LocalAttributeMap (org.springframework.webflow.core.collection.LocalAttributeMap)2 MutableAttributeMap (org.springframework.webflow.core.collection.MutableAttributeMap)2 URI (java.net.URI)1 CasCookieBuilder (org.apereo.cas.web.cookie.CasCookieBuilder)1 CreateSavingsAccountFormBean (org.mifos.ui.core.controller.CreateSavingsAccountFormBean)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 BadlyFormattedFlowExecutionKeyException (org.springframework.webflow.execution.repository.BadlyFormattedFlowExecutionKeyException)1