use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionnaireValidatorTest method getSection.
private SectionDetail getSection(String name) {
SectionDetail section = new SectionDetail();
section.setName(name);
section.addQuestion(new SectionQuestionDetail(new QuestionDetail(12, "Q1", QuestionType.INVALID, true, true), true, null));
return section;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionnaireValidatorTest method getSectionWithOneQuestion.
private SectionDetail getSectionWithOneQuestion(String name, QuestionDetail questionDetail, String response) {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName(name);
sectionDetail.setQuestionDetails(asList(new SectionQuestionDetail(questionDetail, true, response)));
return sectionDetail;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class SectionDetailFormTest method getSectionDefinition.
private SectionDetail getSectionDefinition() {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(121, "Question1", QuestionType.FREETEXT, true, true), true));
sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(122, "Question2", QuestionType.FREETEXT, true, true), false));
sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(123, "Question3", QuestionType.FREETEXT, true, true), true));
return sectionDetail;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupControllerTest method testAddSectionForSuccessWhenQuestionTitleProvidedWithAllBlanks.
@Test
public void testAddSectionForSuccessWhenQuestionTitleProvidedWithAllBlanks() throws Exception {
QuestionGroupForm questionGroup = new QuestionGroupForm();
questionGroup.setQuestionPool(new ArrayList<SectionQuestionDetail>(asList(getSectionQuestionDetail(1, "Q1"), getSectionQuestionDetail(2, "Q2"))));
questionGroup.setSelectedQuestionIds(asList("1", "2"));
questionGroup.setSectionName(" ");
String result = questionGroupController.addSection(questionGroup, requestContext);
assertThat(questionGroup.getSections().size(), Is.is(1));
assertThat(questionGroup.getSections().get(0).getName(), Is.is("Misc"));
assertThat(questionGroup.getSections().get(0).getSectionQuestions().size(), Is.is(2));
assertThat(questionGroup.getSections().get(0).getSectionQuestions().get(0).getText(), Is.is("Q1"));
assertThat(questionGroup.getSections().get(0).getSectionQuestions().get(1).getText(), Is.is("Q2"));
assertThat(result, Is.is("success"));
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupControllerTest method testAddSectionsSuccessWhenSectionNameIsNotProvided.
@Test
public void testAddSectionsSuccessWhenSectionNameIsNotProvided() {
QuestionGroupForm questionGroup = new QuestionGroupForm();
questionGroup.setQuestionPool(new ArrayList<SectionQuestionDetail>(asList(getSectionQuestionDetail(1, "Q1"), getSectionQuestionDetail(2, "Q2"))));
questionGroup.setSelectedQuestionIds(asList("2"));
String result = questionGroupController.addSection(questionGroup, requestContext);
assertThat(questionGroup.getSections().size(), Is.is(1));
assertThat(questionGroup.getSections().get(0).getName(), Is.is("Misc"));
assertThat(questionGroup.getSections().get(0).getSectionQuestions().size(), Is.is(1));
assertThat(questionGroup.getSections().get(0).getSectionQuestions().get(0).getText(), Is.is("Q2"));
assertThat(result, Is.is("success"));
}
Aggregations