Search in sources :

Example 21 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsServiceTest method testSaveUpdateEntityIdOnCreation.

@Test
public void testSaveUpdateEntityIdOnCreation() throws Exception {
    final Integer id = 10;
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsSupport.getModelAdditionalMock(0);
    doAnswer(invocations -> {
        final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = (IssueStandardQuestionTypeOptionEntity) invocations.getArguments()[0];
        questionTypeOptionEntity.setId(id);
        return null;
    }).when(this.questionTypeOptionsMapper).insert(any());
    this.questionTypeOptionsService.save(questionTypeOptionModel);
    verify(questionTypeOptionModel, times(1)).setId(id);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity)

Example 22 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsServiceTest method testDeleteModelsListWithOptions.

@Test
public void testDeleteModelsListWithOptions() throws Exception {
    final ArgumentCaptor<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModelCaptor = ArgumentCaptor.forClass(IssueStandardQuestionTypeOptionModelInterface.class);
    final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionFixturesModels();
    final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
    this.questionTypeOptionsService.delete(questionTypeOptionModels, questionTypeOptionsOptions);
    this.assertServicesSet(questionTypeOptionsOptions, questionTypeOptionModels.size());
    verify(questionTypeOptionsOptions, times(questionTypeOptionModels.size())).deleteWithRelations(questionTypeOptionModelCaptor.capture());
    this.questionTypeOptionsSupport.assertModelsListEquals(questionTypeOptionModels, questionTypeOptionModelCaptor.getAllValues());
    verifyNoMoreInteractions(this.questionTypeOptionsMapper);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionsOptionsInterface(easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface)

Example 23 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsSupport method getModelMock.

private IssueStandardQuestionTypeOptionModelInterface getModelMock(Integer id, Integer questionType, Integer minQuestions, Integer maxQuestions, Integer timeLimit, Integer issueStandardId) {
    final IssueStandardQuestionTypeOptionModelInterface issueStandardQuestionTypeOptionModel = Mockito.mock(IssueStandardQuestionTypeOptionModelInterface.class);
    Mockito.when(issueStandardQuestionTypeOptionModel.getId()).thenReturn(id);
    Mockito.when(issueStandardQuestionTypeOptionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionType));
    Mockito.when(issueStandardQuestionTypeOptionModel.getMinQuestions()).thenReturn(minQuestions);
    Mockito.when(issueStandardQuestionTypeOptionModel.getMaxQuestions()).thenReturn(maxQuestions);
    Mockito.when(issueStandardQuestionTypeOptionModel.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(issueStandardQuestionTypeOptionModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty(issueStandardId));
    return issueStandardQuestionTypeOptionModel;
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty)

Example 24 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsService method map.

private IssueStandardQuestionTypeOptionModelInterface map(IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity) {
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = new IssueStandardQuestionTypeOptionModel();
    questionTypeOptionModel.map(questionTypeOptionEntity);
    return questionTypeOptionModel;
}
Also used : IssueStandardQuestionTypeOptionModel(easytests.core.models.IssueStandardQuestionTypeOptionModel) IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)

Example 25 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionEntityTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer id = 3;
    final Integer questionTypeId = 4;
    final Integer minQuestions = 10;
    final Integer maxQuestions = 20;
    final Integer timeLimit = 600;
    final Integer issueStandardId = 12;
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = Mockito.mock(IssueStandardQuestionTypeOptionModelInterface.class);
    Mockito.when(questionTypeOptionModel.getId()).thenReturn(id);
    Mockito.when(questionTypeOptionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionTypeId));
    Mockito.when(questionTypeOptionModel.getMinQuestions()).thenReturn(minQuestions);
    Mockito.when(questionTypeOptionModel.getMaxQuestions()).thenReturn(maxQuestions);
    Mockito.when(questionTypeOptionModel.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(questionTypeOptionModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty(issueStandardId));
    final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = new IssueStandardQuestionTypeOptionEntity();
    questionTypeOptionEntity.map(questionTypeOptionModel);
    Assert.assertEquals(id, questionTypeOptionEntity.getId());
    Assert.assertEquals(questionTypeId, questionTypeOptionEntity.getQuestionTypeId());
    Assert.assertEquals(minQuestions, questionTypeOptionEntity.getMinQuestions());
    Assert.assertEquals(maxQuestions, questionTypeOptionEntity.getMaxQuestions());
    Assert.assertEquals(timeLimit, questionTypeOptionEntity.getTimeLimit());
    Assert.assertEquals(issueStandardId, questionTypeOptionEntity.getIssueStandardId());
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty) Test(org.junit.Test)

Aggregations

IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)39 Test (org.junit.Test)30 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)29 IssueStandardQuestionTypeOptionEntity (easytests.core.entities.IssueStandardQuestionTypeOptionEntity)9 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)9 IssueStandardQuestionTypeOptionsOptionsInterface (easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface)9 ArrayList (java.util.ArrayList)7 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)5 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)5 QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)4 IssueStandardQuestionTypeOptionsServiceInterface (easytests.core.services.IssueStandardQuestionTypeOptionsServiceInterface)4 QuestionTypesServiceInterface (easytests.core.services.QuestionTypesServiceInterface)3 IssueStandardQuestionTypeOptionModel (easytests.core.models.IssueStandardQuestionTypeOptionModel)2 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)2 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)2 SubjectModelInterface (easytests.core.models.SubjectModelInterface)2 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)2 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)2 IssueStandardTopicPrioritiesServiceInterface (easytests.core.services.IssueStandardTopicPrioritiesServiceInterface)2 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)2