Search in sources :

Example 1 with QuestionDetailMatcher

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);
}
Also used : QuestionDetailMatcher(org.mifos.platform.questionnaire.matchers.QuestionDetailMatcher) ChoiceDto(org.mifos.platform.questionnaire.service.dtos.ChoiceDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 QuestionDetailMatcher (org.mifos.platform.questionnaire.matchers.QuestionDetailMatcher)1 ChoiceDto (org.mifos.platform.questionnaire.service.dtos.ChoiceDto)1