Search in sources :

Example 1 with QuestionGroupDetailFormMatcher

use of org.mifos.platform.questionnaire.matchers.QuestionGroupDetailFormMatcher in project head by mifos.

the class QuestionGroupControllerTest method shouldGetQuestionGroupById.

@Test
public void shouldGetQuestionGroupById() throws SystemException {
    int questionGroupId = 1;
    QuestionGroupDetail questionGroupDetail = getQuestionGroupDetail(questionGroupId, TITLE, "S1", "S2", "S3");
    when(questionnaireServiceFacade.getQuestionGroupDetail(questionGroupId)).thenReturn(questionGroupDetail);
    when(httpServletRequest.getParameter("questionGroupId")).thenReturn(Integer.toString(questionGroupId));
    String view = questionGroupController.getQuestionGroup(model, httpServletRequest);
    assertThat(view, Is.is("viewQuestionGroupDetail"));
    verify(questionnaireServiceFacade).getQuestionGroupDetail(questionGroupId);
    verify(questionnaireServiceFacade, times(1)).getAllEventSources();
    verify(httpServletRequest, times(1)).getParameter("questionGroupId");
    verify(model).addAttribute(Matchers.eq("questionGroupDetail"), argThat(new QuestionGroupDetailFormMatcher(new QuestionGroupForm(questionGroupDetail))));
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) QuestionGroupDetailFormMatcher(org.mifos.platform.questionnaire.matchers.QuestionGroupDetailFormMatcher) QuestionGroupForm(org.mifos.platform.questionnaire.ui.model.QuestionGroupForm) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 QuestionGroupDetailFormMatcher (org.mifos.platform.questionnaire.matchers.QuestionGroupDetailFormMatcher)1 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)1 QuestionGroupForm (org.mifos.platform.questionnaire.ui.model.QuestionGroupForm)1