Search in sources :

Example 36 with SectionDetail

use of org.mifos.platform.questionnaire.service.SectionDetail in project head by mifos.

the class SectionDetailFormTest method getSectionDefinition.

private SectionDetail getSectionDefinition() {
    SectionDetail sectionDetail = new SectionDetail();
    sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(121, "Question1", QuestionType.FREETEXT, true, true), true));
    sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(122, "Question2", QuestionType.FREETEXT, true, true), false));
    sectionDetail.addQuestion(new SectionQuestionDetail(new QuestionDetail(123, "Question3", QuestionType.FREETEXT, true, true), true));
    return sectionDetail;
}
Also used : SectionQuestionDetail(org.mifos.platform.questionnaire.service.SectionQuestionDetail) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail) SectionQuestionDetail(org.mifos.platform.questionnaire.service.SectionQuestionDetail) QuestionDetail(org.mifos.platform.questionnaire.service.QuestionDetail)

Example 37 with SectionDetail

use of org.mifos.platform.questionnaire.service.SectionDetail in project head by mifos.

the class QuestionGroupFormTest method shouldGetEventSourceId.

@Test
public void shouldGetEventSourceId() {
    EventSourceDto eventSourceDto = new EventSourceDto("Create", "Client", "Create Client");
    QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail(123, "Title", Arrays.asList(eventSourceDto), new ArrayList<SectionDetail>(), false);
    QuestionGroupForm questionGroupForm = new QuestionGroupForm(questionGroupDetail);
    assertThat(questionGroupForm.getEventSourceIds().get(0), is("Create.Client"));
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) QuestionGroupForm(org.mifos.platform.questionnaire.ui.model.QuestionGroupForm) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail) EventSourceDto(org.mifos.platform.questionnaire.service.dtos.EventSourceDto) Test(org.junit.Test)

Example 38 with SectionDetail

use of org.mifos.platform.questionnaire.service.SectionDetail in project head by mifos.

the class QuestionGroupFormTest method shouldGetSections.

@Test
public void shouldGetSections() {
    SectionDetail sectionDetail = new SectionDetail();
    sectionDetail.setName("Section1");
    QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail(123, "Title", null, asList(sectionDetail), false);
    QuestionGroupForm questionGroupForm = new QuestionGroupForm(questionGroupDetail);
    List<SectionDetailForm> sections = questionGroupForm.getSections();
    assertThat(questionGroupForm.getInitialCountOfSections(), is(1));
    assertThat(sections, notNullValue());
    assertThat(sections.size(), is(1));
    assertThat(sections.get(0).getName(), is("Section1"));
    assertThat(sections.get(0).getInitialCountOfQuestions(), is(0));
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) SectionDetailForm(org.mifos.platform.questionnaire.ui.model.SectionDetailForm) QuestionGroupForm(org.mifos.platform.questionnaire.ui.model.QuestionGroupForm) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail) Test(org.junit.Test)

Example 39 with SectionDetail

use of org.mifos.platform.questionnaire.service.SectionDetail in project head by mifos.

the class QuestionGroupControllerTest method getQuestionGroupDetail.

private QuestionGroupDetail getQuestionGroupDetail(int questionGroupId, String title, String... sectionNames) {
    List<SectionDetail> sectionDetails = new ArrayList<SectionDetail>();
    for (String sectionName : sectionNames) {
        SectionDetail sectionDetail = new SectionDetail();
        sectionDetail.setName(sectionName);
        sectionDetails.add(sectionDetail);
    }
    return new QuestionGroupDetail(questionGroupId, title, sectionDetails);
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ArrayList(java.util.ArrayList) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail)

Example 40 with SectionDetail

use of org.mifos.platform.questionnaire.service.SectionDetail in project head by mifos.

the class QuestionnaireMapperIntegrationTest method getSectionDefinitions.

private List<SectionDetail> getSectionDefinitions() {
    List<SectionDetail> sectionDetails = new ArrayList<SectionDetail>();
    SectionDetail sectionDetail = new SectionDetail();
    sectionDetail.setName("Name");
    sectionDetails.add(sectionDetail);
    return sectionDetails;
}
Also used : ArrayList(java.util.ArrayList) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail)

Aggregations

SectionDetail (org.mifos.platform.questionnaire.service.SectionDetail)56 SectionQuestionDetail (org.mifos.platform.questionnaire.service.SectionQuestionDetail)34 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)25 QuestionDetail (org.mifos.platform.questionnaire.service.QuestionDetail)24 Test (org.junit.Test)21 ArrayList (java.util.ArrayList)20 QuestionGroup (org.mifos.platform.questionnaire.domain.QuestionGroup)13 EventSourceDto (org.mifos.platform.questionnaire.service.dtos.EventSourceDto)12 Transactional (org.springframework.transaction.annotation.Transactional)7 QuestionGroupInstance (org.mifos.platform.questionnaire.domain.QuestionGroupInstance)5 SectionQuestion (org.mifos.platform.questionnaire.domain.SectionQuestion)5 ChoiceDto (org.mifos.platform.questionnaire.service.dtos.ChoiceDto)5 ValidationException (org.mifos.platform.validations.ValidationException)5 EventSourceEntity (org.mifos.platform.questionnaire.domain.EventSourceEntity)4 QuestionEntity (org.mifos.platform.questionnaire.domain.QuestionEntity)3 Section (org.mifos.platform.questionnaire.domain.Section)3 BadNumericResponseException (org.mifos.platform.questionnaire.exceptions.BadNumericResponseException)3 QuestionGroupForm (org.mifos.platform.questionnaire.ui.model.QuestionGroupForm)3 QuestionGroupResponse (org.mifos.platform.questionnaire.domain.QuestionGroupResponse)2 QuestionGroupDetails (org.mifos.platform.questionnaire.service.QuestionGroupDetails)2