use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class GroupCustActionTest method getSectionDetail.
private SectionDetail getSectionDetail(String name, String title, List<String> answerChoices) {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName(name);
QuestionDetail questionDetail = new QuestionDetail(111, title, QuestionType.SINGLE_SELECT, true, true);
List<ChoiceDto> choiceDtos = new ArrayList<ChoiceDto>();
for (String answerChoice : answerChoices) {
choiceDtos.add(new ChoiceDto(answerChoice));
}
questionDetail.setAnswerChoices(choiceDtos);
sectionDetail.setQuestionDetails(asList(new SectionQuestionDetail(questionDetail, true)));
return sectionDetail;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupControllerTest method shouldGetAllSectionQuestionsWithoutExcludedQuestions.
@Test
public void shouldGetAllSectionQuestionsWithoutExcludedQuestions() {
List<Integer> excludedQuestions = asList(3);
List<QuestionDetail> questionDetails = asList(getQuestionDetail(1, "Q1", QuestionType.NUMERIC), getQuestionDetail(2, "Q2", QuestionType.DATE));
when(questionnaireServiceFacade.getAllActiveQuestions(excludedQuestions)).thenReturn(questionDetails);
QuestionGroupForm questionGroupForm = getQuestionGroupFormWithOneSectionQuestion("QG1", 3);
List<SectionQuestionDetail> sectionQuestions = questionGroupController.getAllSectionQuestions(questionGroupForm);
assertThat(sectionQuestions, Is.is(notNullValue()));
assertThat(sectionQuestions.size(), Is.is(2));
assertThat(sectionQuestions.get(0).getQuestionId(), Is.is(1));
assertThat(sectionQuestions.get(0).getText(), Is.is("Q1"));
assertThat(sectionQuestions.get(1).getQuestionId(), Is.is(2));
assertThat(sectionQuestions.get(1).getText(), Is.is("Q2"));
verify(questionnaireServiceFacade).getAllActiveQuestions(excludedQuestions);
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionnaireMapperTest method getSectionDetailWithQuestions.
private SectionDetail getSectionDetailWithQuestions(int id, String name, List<QuestionDetail> questionDetails, String answer, List<String> answers) {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName(name);
List<SectionQuestionDetail> sectionQuestionDetails = new ArrayList<SectionQuestionDetail>();
for (QuestionDetail questionDetail : questionDetails) {
SectionQuestionDetail sectionQuestionDetail = new SectionQuestionDetail(id, questionDetail, false, answer, getSelections(answers));
sectionQuestionDetails.add(sectionQuestionDetail);
}
sectionDetail.setQuestionDetails(sectionQuestionDetails);
return sectionDetail;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionnaireMapperTest method getSectionDetailWithQuestions.
private SectionDetail getSectionDetailWithQuestions(int id, String name, List<QuestionDetail> questionDetails, List<SelectionDetail> answers) {
SectionDetail sectionDetail = new SectionDetail();
sectionDetail.setName(name);
List<SectionQuestionDetail> sectionQuestionDetails = new ArrayList<SectionQuestionDetail>();
for (QuestionDetail questionDetail : questionDetails) {
SectionQuestionDetail sectionQuestionDetail = new SectionQuestionDetail(id, questionDetail, false, null, answers);
sectionQuestionDetails.add(sectionQuestionDetail);
}
sectionDetail.setQuestionDetails(sectionQuestionDetails);
return sectionDetail;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionnaireMapperTest method getSectionQuestionDetail.
private SectionQuestionDetail getSectionQuestionDetail(int secQuesId, int quesId, String quesText) {
SectionQuestionDetail sectionQuestionDetail1 = new SectionQuestionDetail();
sectionQuestionDetail1.setId(secQuesId);
QuestionDetail questionDetail = new QuestionDetail();
questionDetail.setId(quesId);
questionDetail.setText(quesText);
questionDetail.setType(QuestionType.FREETEXT);
sectionQuestionDetail1.setQuestionDetail(questionDetail);
return sectionQuestionDetail1;
}
Aggregations