use of org.mifos.platform.questionnaire.matchers.QuestionDetailMatcher in project head by mifos.
the class QuestionnaireServiceFacadeTest method testGetQuestionWithAnswerChoicesById.
@Test
public void testGetQuestionWithAnswerChoicesById() throws SystemException {
int questionId = 1;
String title = "Title";
List<ChoiceDto> answerChoices = asList(new ChoiceDto("choice1"), new ChoiceDto("choice2"));
QuestionDetail expectedQuestionDetail = new QuestionDetail(questionId, title, QuestionType.MULTI_SELECT, true, true);
expectedQuestionDetail.setAnswerChoices(answerChoices);
when(questionnaireService.getQuestion(questionId)).thenReturn(expectedQuestionDetail);
QuestionDetail questionDetail = questionnaireServiceFacade.getQuestionDetail(questionId);
Assert.assertNotNull("Question group should not be null", questionDetail);
assertThat(questionDetail, new QuestionDetailMatcher(expectedQuestionDetail));
Mockito.verify(questionnaireService).getQuestion(questionId);
}
Aggregations