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))));
}
Aggregations