Search in sources :

Example 1 with QuestionGroupResponseDto

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

the class QuestionnaireMapperTest method getQuestionGroupInstanceDto.

private QuestionGroupInstanceDto getQuestionGroupInstanceDto() {
    QuestionGroupInstanceDtoBuilder instanceBuilder = new QuestionGroupInstanceDtoBuilder();
    QuestionGroupResponseDtoBuilder responseBuilder = new QuestionGroupResponseDtoBuilder();
    responseBuilder.withResponse("Answer1").withSectionQuestion(999);
    QuestionGroupResponseDto questionGroupResponseDto = responseBuilder.build();
    instanceBuilder.withQuestionGroup(123).withCompleted(true).withCreator(111).withEventSource(1).withEntity(12345).withVersion(1).addResponses(questionGroupResponseDto);
    return instanceBuilder.build();
}
Also used : QuestionGroupResponseDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupResponseDtoBuilder) QuestionGroupInstanceDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupInstanceDtoBuilder) QuestionGroupResponseDto(org.mifos.platform.questionnaire.service.dtos.QuestionGroupResponseDto)

Example 2 with QuestionGroupResponseDto

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

the class QuestionnaireServiceTest method shouldSaveQuestionGroupInstance.

@Test
public void shouldSaveQuestionGroupInstance() {
    QuestionGroupInstanceDtoBuilder instanceBuilder = new QuestionGroupInstanceDtoBuilder();
    QuestionGroupResponseDtoBuilder responseBuilder = new QuestionGroupResponseDtoBuilder();
    responseBuilder.withResponse("Answer1").withSectionQuestion(999);
    QuestionGroupResponseDto questionGroupResponseDto = responseBuilder.build();
    instanceBuilder.withQuestionGroup(123).withCompleted(true).withCreator(111).withEventSource(1).withEntity(12345).withVersion(1).addResponses(questionGroupResponseDto);
    QuestionGroupInstanceDto questionGroupInstanceDto = instanceBuilder.build();
    when(questionGroupInstanceDao.create(Matchers.<QuestionGroupInstance>any())).thenReturn(789);
    Integer qgInstanceId = questionnaireService.saveQuestionGroupInstance(questionGroupInstanceDto);
    assertThat(qgInstanceId, is(789));
    verify(questionGroupInstanceDao).create(any(QuestionGroupInstance.class));
}
Also used : QuestionGroupResponseDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupResponseDtoBuilder) QuestionGroupInstanceDto(org.mifos.platform.questionnaire.service.dtos.QuestionGroupInstanceDto) QuestionGroupInstanceDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupInstanceDtoBuilder) QuestionGroupResponseDto(org.mifos.platform.questionnaire.service.dtos.QuestionGroupResponseDto) Test(org.junit.Test)

Example 3 with QuestionGroupResponseDto

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

the class QuestionnaireServiceIntegrationTest method getQuestionGroupInstanceDto.

private QuestionGroupInstanceDto getQuestionGroupInstanceDto(String response, Integer creatorId, Integer entityId, Integer questionGroupId, Integer sectionQuestionId) {
    QuestionGroupInstanceDtoBuilder instanceBuilder = new QuestionGroupInstanceDtoBuilder();
    QuestionGroupResponseDtoBuilder responseBuilder = new QuestionGroupResponseDtoBuilder();
    responseBuilder.withResponse(response).withSectionQuestion(sectionQuestionId);
    QuestionGroupResponseDto questionGroupResponseDto = responseBuilder.build();
    instanceBuilder.withQuestionGroup(questionGroupId).withCompleted(true).withCreator(creatorId).withEventSource(1).withEntity(entityId).withVersion(1).addResponses(questionGroupResponseDto);
    return instanceBuilder.build();
}
Also used : QuestionGroupResponseDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupResponseDtoBuilder) QuestionGroupInstanceDtoBuilder(org.mifos.platform.questionnaire.builders.QuestionGroupInstanceDtoBuilder) QuestionGroupResponseDto(org.mifos.platform.questionnaire.service.dtos.QuestionGroupResponseDto)

Aggregations

QuestionGroupInstanceDtoBuilder (org.mifos.platform.questionnaire.builders.QuestionGroupInstanceDtoBuilder)3 QuestionGroupResponseDtoBuilder (org.mifos.platform.questionnaire.builders.QuestionGroupResponseDtoBuilder)3 QuestionGroupResponseDto (org.mifos.platform.questionnaire.service.dtos.QuestionGroupResponseDto)3 Test (org.junit.Test)1 QuestionGroupInstanceDto (org.mifos.platform.questionnaire.service.dtos.QuestionGroupInstanceDto)1