use of org.mifos.platform.questionnaire.service.QuestionDetail in project head by mifos.
the class QuestionTest method testRemoveChoiceTag.
@Test
public void testRemoveChoiceTag() {
Question question = new Question(new QuestionDetail());
question.setCurrentSmartChoice("Choice1");
question.addAnswerSmartChoice();
question.getCurrentSmartChoiceTags().set(0, "Tag1");
question.addSmartChoiceTag(0);
question.getCurrentSmartChoiceTags().set(0, "Tag2");
question.addSmartChoiceTag(0);
question.getCurrentSmartChoiceTags().set(0, "Tag3");
question.addSmartChoiceTag(0);
question.getCurrentSmartChoiceTags().set(0, "Tag4");
question.addSmartChoiceTag(0);
question.removeChoiceTag("0_2");
assertThat(question.getQuestionDetail().getAnswerChoices().size(), is(1));
assertThat(question.getQuestionDetail().getAnswerChoices().get(0).getTags().size(), is(3));
assertThat(question.getQuestionDetail().getAnswerChoices().get(0).getTags().get(0), is("Tag1"));
assertThat(question.getQuestionDetail().getAnswerChoices().get(0).getTags().get(1), is("Tag2"));
assertThat(question.getQuestionDetail().getAnswerChoices().get(0).getTags().get(2), is("Tag4"));
question.removeChoiceTag("0_0");
question.removeChoiceTag("0_0");
question.removeChoiceTag("0_0");
assertThat(question.getQuestionDetail().getAnswerChoices().size(), is(1));
assertThat(question.getQuestionDetail().getAnswerChoices().get(0).getTags().size(), is(0));
}
use of org.mifos.platform.questionnaire.service.QuestionDetail in project head by mifos.
the class LoanAccountActionTest 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.QuestionDetail in project head by mifos.
the class QuestionGroupController method getAllSectionQuestions.
public List<SectionQuestionDetail> getAllSectionQuestions() {
List<SectionQuestionDetail> sectionQuestionDetails = new ArrayList<SectionQuestionDetail>();
List<QuestionDetail> questionDetails = questionnaireServiceFacade.getAllActiveQuestions();
if (questionDetails != null) {
for (QuestionDetail questionDetail : questionDetails) {
sectionQuestionDetails.add(new SectionQuestionDetail(questionDetail, false));
}
}
return sectionQuestionDetails;
}
use of org.mifos.platform.questionnaire.service.QuestionDetail in project head by mifos.
the class QuestionnaireFlowAdapterTest method getQuestionGroups.
private List<QuestionGroupDetail> getQuestionGroups() {
List<QuestionDetail> questions = Arrays.asList(new QuestionDetail(12, "Question1", QuestionType.FREETEXT, true, true));
List<SectionDetail> section = Arrays.asList(getSectionDetailWithQuestions("Section1", questions, null, true));
QuestionGroupDetail questionGroup = getQuestionGroupDetail("Group1", "Create", "Loan", section);
return Arrays.asList(questionGroup);
}
use of org.mifos.platform.questionnaire.service.QuestionDetail in project head by mifos.
the class ClientCustActionTest 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;
}
Aggregations