use of org.mifos.platform.questionnaire.domain.QuestionGroupResponse in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionGroupResponse.
private QuestionGroupResponse mapToQuestionGroupResponse(QuestionGroupInstance questionGroupInstance, SectionQuestion sectionQuestion, SelectionDetail selectionDetail) {
QuestionGroupResponse questionGroupResponse = mapToQuestionGroupResponse(questionGroupInstance, sectionQuestion, selectionDetail.getSelectedChoice());
questionGroupResponse.setTag(selectionDetail.getSelectedTag());
return questionGroupResponse;
}
use of org.mifos.platform.questionnaire.domain.QuestionGroupResponse in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionGroupResponse.
private QuestionGroupResponse mapToQuestionGroupResponse(QuestionGroupInstance questionGroupInstance, QuestionGroupResponseDto questionGroupResponseDto) {
QuestionGroupResponse questionGroupResponse = new QuestionGroupResponse();
questionGroupResponse.setResponse(questionGroupResponseDto.getResponse());
questionGroupResponse.setQuestionGroupInstance(questionGroupInstance);
SectionQuestion sq;
if (sectionQuestionMap.containsKey(questionGroupResponseDto.getSectionQuestionId())) {
sq = sectionQuestionMap.get(questionGroupResponseDto.getSectionQuestionId());
} else {
sq = sectionQuestionDao.getDetails(questionGroupResponseDto.getSectionQuestionId());
sectionQuestionMap.put(questionGroupResponseDto.getSectionQuestionId(), sq);
}
questionGroupResponse.setSectionQuestion(sq);
return questionGroupResponse;
}
use of org.mifos.platform.questionnaire.domain.QuestionGroupResponse in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionGroupResponse.
private QuestionGroupResponse mapToQuestionGroupResponse(QuestionGroupInstance questionGroupInstance, SectionQuestion sectionQuestion, String value) {
QuestionGroupResponse questionGroupResponse = new QuestionGroupResponse();
questionGroupResponse.setSectionQuestion(sectionQuestion);
questionGroupResponse.setResponse(value);
questionGroupResponse.setQuestionGroupInstance(questionGroupInstance);
return questionGroupResponse;
}
use of org.mifos.platform.questionnaire.domain.QuestionGroupResponse in project head by mifos.
the class QuestionnaireMapperTest method getQuestionGroupResponse.
private QuestionGroupResponse getQuestionGroupResponse(String response, QuestionGroupInstance instance, SectionQuestion sectionQuestion) {
QuestionGroupResponse questionGroupResponse = new QuestionGroupResponse();
questionGroupResponse.setResponse(response);
questionGroupResponse.setQuestionGroupInstance(instance);
questionGroupResponse.setSectionQuestion(sectionQuestion);
return questionGroupResponse;
}
use of org.mifos.platform.questionnaire.domain.QuestionGroupResponse in project head by mifos.
the class QuestionnaireMapperTest method shouldMapToQuestionGroupInstance.
@Test
public void shouldMapToQuestionGroupInstance() {
QuestionGroupInstanceDto questionGroupInstanceDto = getQuestionGroupInstanceDto();
QuestionGroup questionGroup = new QuestionGroup();
when(questionGroupDao.getDetails(123)).thenReturn(questionGroup);
SectionQuestion sectionQuestion = new SectionQuestion();
when(sectionQuestionDao.getDetails(999)).thenReturn(sectionQuestion);
QuestionGroupInstance questionGroupInstance = questionnaireMapper.mapToQuestionGroupInstance(questionGroupInstanceDto);
assertThat(questionGroupInstance, is(notNullValue()));
assertThat(questionGroupInstance.getCompletedStatus(), is(1));
assertThat(questionGroupInstance.getCreatorId(), is(111));
assertThat(questionGroupInstance.getEntityId(), is(12345));
assertThat(questionGroupInstance.getVersionNum(), is(1));
assertThat(questionGroupInstance.getQuestionGroup(), is(questionGroup));
List<QuestionGroupResponse> questionGroupResponses = questionGroupInstance.getQuestionGroupResponses();
assertThat(questionGroupResponses, is(notNullValue()));
assertThat(questionGroupResponses.size(), is(1));
QuestionGroupResponse questionGroupResponse = questionGroupResponses.get(0);
assertThat(questionGroupResponse.getResponse(), is("Answer1"));
assertThat(questionGroupResponse.getSectionQuestion(), is(sectionQuestion));
verify(questionGroupDao).getDetails(123);
verify(sectionQuestionDao).getDetails(999);
}
Aggregations