use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters in project head by mifos.
the class QuestionGroupLoanAccountTest method verifyCapturingResponsesDuringLoanDisburse.
/**
* Capturing responses during the Loan disburse
* http://mifosforge.jira.com/browse/MIFOSTEST-668
*
* @throws Exception
*/
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyCapturingResponsesDuringLoanDisburse() throws Exception {
questionGroupTestHelper.markQuestionGroupAsActive("QGForDisburseLoan1");
questionGroupTestHelper.markQuestionGroupAsActive("QGForDisburseLoan2");
try {
CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
DisburseLoanParameters disburseLoanParameters = new DisburseLoanParameters();
disburseLoanParameters.setPaymentType(DisburseLoanParameters.CASH);
disburseLoanParameters.setDisbursalDateDD("24");
disburseLoanParameters.setDisbursalDateMM("02");
disburseLoanParameters.setDisbursalDateYYYY("2011");
QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "free text");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "free text1");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "07/02/2011");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "20");
questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].valuesAsArray", "three");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "free text2");
LoanAccountPage loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(createLoanAccountSearchParameters);
String loan1ID = loanAccountPage.getAccountId();
loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(createLoanAccountSearchParameters);
String loan2ID = loanAccountPage.getAccountId();
QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanDisbursal(loan1ID, disburseLoanParameters);
questionResponsePage.populateAnswers(questionResponseParameters);
questionResponsePage = questionResponsePage.continueAndNavigateToDisburseLoanConfirmationPage().navigateToEditAdditionalInformation();
questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
questionResponsePage.populateAnswers(questionResponseParameters);
questionResponsePage.continueAndNavigateToDisburseLoanConfirmationPage().submitAndNavigateToLoanAccountPage();
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
createQuestionParameters.setText("createdByverifyCapturingResponsesDuringLoanDisburse");
List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
newQuestionList.add(createQuestionParameters);
String[] questionsExist = { "Date", "FreeText", "SingleSelect", "createdByverifyCapturingResponsesDuringLoanDisburse" };
String[] questionsInactive = { "ToBeDisabled" };
Map<String, String> questionsAndAnswers = new HashMap<String, String>();
questionsAndAnswers.put("MultiSelect", "three");
questionsAndAnswers.put("Number", "20");
questionsAndAnswers.put("Date", "04/02/2011");
questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan2");
questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForDisburseLoan1", newQuestionList);
questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanDisbursal(loan2ID, disburseLoanParameters);
questionResponsePage.verifyQuestionsExists(questionsExist);
questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
verifyQuestionResponsesExistInDatabase(loan1ID, "Disburse Loan", questionsAndAnswers);
} finally {
questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan1");
questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan2");
}
}
Aggregations