use of org.mifos.platform.questionnaire.service.dtos.ChoiceDto in project head by mifos.
the class Question method addAnswerSmartChoice.
public void addAnswerSmartChoice() {
questionDetail.addAnswerChoice(new ChoiceDto(getCurrentSmartChoice()));
currentSmartChoiceTags.add(EMPTY);
setCurrentSmartChoice(null);
}
use of org.mifos.platform.questionnaire.service.dtos.ChoiceDto in project head by mifos.
the class QuestionnaireMapperImpl method mapToChoiceDetail.
private ChoiceDto mapToChoiceDetail(QuestionChoiceEntity questionChoice) {
ChoiceDto choiceDto = new ChoiceDto(questionChoice.getChoiceText());
mapToChoiceTags(choiceDto, questionChoice.getTags());
return choiceDto;
}
use of org.mifos.platform.questionnaire.service.dtos.ChoiceDto 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;
}
use of org.mifos.platform.questionnaire.service.dtos.ChoiceDto in project head by mifos.
the class QuestionFormTest method testAddCurrentQuestion.
@Test
public void testAddCurrentQuestion() {
QuestionForm questionForm = getQuestionForm(" Q1 ", "freeText", "choice1");
List<Question> questionList = questionForm.getQuestions();
assertThat(questionList.size(), is(1));
String text = questionList.get(0).getText();
String type = questionList.get(0).getType();
List<ChoiceDto> choices = questionList.get(0).getChoices();
assertNotSame(text, questionForm.getCurrentQuestion().getText());
assertNotSame(type, questionForm.getCurrentQuestion().getType());
assertThat(text, is("Q1"));
assertThat(type, is("freeText"));
assertThat(choices.size(), is(0));
}
use of org.mifos.platform.questionnaire.service.dtos.ChoiceDto in project head by mifos.
the class QuestionFormTest method testAddCurrentSingleSelectQuestion.
@Test
public void testAddCurrentSingleSelectQuestion() {
QuestionForm questionForm = getQuestionForm("title1", "singleSelect", "choice");
List<Question> questionList = questionForm.getQuestions();
assertThat(questionList.size(), is(1));
String text = questionList.get(0).getText();
String type = questionList.get(0).getType();
List<ChoiceDto> choices = questionList.get(0).getChoices();
assertNotSame(text, questionForm.getCurrentQuestion().getText());
assertNotSame(type, questionForm.getCurrentQuestion().getType());
assertThat(choices.get(0).getValue(), is("choice"));
assertThat(text, is("title1"));
assertThat(type, is("singleSelect"));
}
Aggregations