use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class QuestionGroupFormTest method shouldGetSections.
@Test
public void shouldGetSections() {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName("Section1");
QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail(123, "Title", null, asList(sectionDetail), false);
QuestionGroupForm questionGroupForm = new QuestionGroupForm(questionGroupDetail);
List<SectionDetailForm> sections = questionGroupForm.getSections();
assertThat(questionGroupForm.getInitialCountOfSections(), is(1));
assertThat(sections, notNullValue());
assertThat(sections.size(), is(1));
assertThat(sections.get(0).getName(), is("Section1"));
assertThat(sections.get(0).getInitialCountOfQuestions(), is(0));
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class QuestionGroupControllerTest method testCreateQuestionGroupSuccess.
@Test
public void testCreateQuestionGroupSuccess() throws Exception {
QuestionGroupForm questionGroup = getQuestionGroupForm(" " + TITLE + " ", "Create.Client", "S1", "S2");
String result = questionGroupController.defineQuestionGroup(questionGroup, requestContext, true);
assertThat(result, Is.is("success"));
QuestionGroupDetail questionGroupDetail = getQuestionGroupDetail(TITLE, "Create", "Client", "S1", "S2");
questionGroupDetail.setActive(true);
verify(questionnaireServiceFacade).createActiveQuestionGroup(argThat(new QuestionGroupDetailMatcher(questionGroupDetail)));
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class QuestionGroupControllerTest method getQuestionGroupDetail.
private QuestionGroupDetail getQuestionGroupDetail(int questionGroupId, String title, String... sectionNames) {
List<SectionDetail> sectionDetails = new ArrayList<SectionDetail>();
for (String sectionName : sectionNames) {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName(sectionName);
sectionDetails.add(sectionDetail);
}
return new QuestionGroupDetail(questionGroupId, title, sectionDetails);
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class CreateSavingsAccountFormBeanTest method validateAnswerQuestionGroupStepEmptyQuestionGroupShouldPass.
@Test
public void validateAnswerQuestionGroupStepEmptyQuestionGroupShouldPass() {
List<QuestionGroupDetail> questionGroups = new ArrayList<QuestionGroupDetail>();
formBean.setQuestionGroups(questionGroups);
formBean.validateAnswerQuestionGroupStep(validationContext);
MessageContext messageContext = validationContext.getMessageContext();
Message[] messages = messageContext.getAllMessages();
Assert.assertEquals(0, messages.length);
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class LoanPrdActionTest method getQuestionGroupDetail.
private QuestionGroupDetail getQuestionGroupDetail(int id, String title, boolean active) {
QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail();
questionGroupDetail.setId(id);
questionGroupDetail.setTitle(title);
questionGroupDetail.setActive(active);
return questionGroupDetail;
}
Aggregations