use of org.mifos.platform.questionnaire.exceptions.MandatoryAnswerNotFoundException in project head by mifos.
the class QuestionnaireServiceTest method testValidateResponse.
@Test
public void testValidateResponse() {
List<QuestionDetail> questionDetails = asList(new QuestionDetail(12, "Question 1", QuestionType.FREETEXT, true, true));
List<SectionDetail> sectionDetails = asList(getSectionDetailWithQuestions("Sec1", questionDetails, null, true));
QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail(1, "QG1", Arrays.asList(new EventSourceDto("Create", "Client", null)), sectionDetails, true);
try {
doThrow(new MandatoryAnswerNotFoundException("Title")).when(questionnaireValidator).validateForQuestionGroupResponses(asList(questionGroupDetail));
questionnaireService.validateResponses(asList(questionGroupDetail));
Assert.fail("Should not have thrown the validation exception");
} catch (ValidationException e) {
verify(questionnaireValidator, times(1)).validateForQuestionGroupResponses(asList(questionGroupDetail));
}
}
Aggregations