use of org.mifos.platform.questionnaire.matchers.QuestionGroupDetailMatcher in project head by mifos.
the class QuestionnaireServiceFacadeTest method testGetQuestionGroupById.
@Test
public void testGetQuestionGroupById() throws Exception {
int questionGroupId = 1;
List<SectionDetail> sections = asList(getSectionDetailWithQuestionIds("S1", 121), getSectionDetailWithQuestionIds("S2", 122, 123));
QuestionGroupDetail expectedQuestionGroupDetail = getQuestionGroupDetail(TITLE, "Create", "Client", sections);
when(questionnaireService.getQuestionGroupById(questionGroupId)).thenReturn(questionGroup);
when(questionGroup.getActivityId()).thenReturn((short) -1);
when(rolesPermissionServiceFacade.hasUserAccessForActivity(questionGroup.getActivityId())).thenReturn(true);
when(questionnaireService.getQuestionGroup(questionGroupId)).thenReturn(expectedQuestionGroupDetail);
QuestionGroupDetail questionGroupDetail = questionnaireServiceFacade.getQuestionGroupDetail(questionGroupId);
assertThat(questionGroupDetail, new QuestionGroupDetailMatcher(expectedQuestionGroupDetail));
}
use of org.mifos.platform.questionnaire.matchers.QuestionGroupDetailMatcher in project head by mifos.
the class QuestionGroupControllerTest method testEditQuestionGroupSuccess.
@Test
public void testEditQuestionGroupSuccess() throws Exception {
QuestionGroupForm questionGroup = getQuestionGroupForm(" " + TITLE + " ", "Create.Client", "S1", "S2");
String result = questionGroupController.defineQuestionGroup(questionGroup, requestContext, false);
assertThat(result, Is.is("success"));
QuestionGroupDetail questionGroupDetail = getQuestionGroupDetail(TITLE, "Create", "Client", "S1", "S2");
questionGroupDetail.setActive(false);
verify(questionnaireServiceFacade).createQuestionGroup(argThat(new QuestionGroupDetailMatcher(questionGroupDetail)));
}
use of org.mifos.platform.questionnaire.matchers.QuestionGroupDetailMatcher in project head by mifos.
the class QuestionGroupControllerTest method testCreateQuestionGroupSuccess.
@Test
public void testCreateQuestionGroupSuccess() throws Exception {
QuestionGroupForm questionGroup = getQuestionGroupForm(" " + TITLE + " ", "Create.Client", "S1", "S2");
String result = questionGroupController.defineQuestionGroup(questionGroup, requestContext, true);
assertThat(result, Is.is("success"));
QuestionGroupDetail questionGroupDetail = getQuestionGroupDetail(TITLE, "Create", "Client", "S1", "S2");
questionGroupDetail.setActive(true);
verify(questionnaireServiceFacade).createActiveQuestionGroup(argThat(new QuestionGroupDetailMatcher(questionGroupDetail)));
}
Aggregations