Search in sources :

Example 6 with IssueStandardQuestionTypeOptionEntity

use of easytests.core.entities.IssueStandardQuestionTypeOptionEntity in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsMapperTest method testDelete.

@Test
public void testDelete() throws Exception {
    Integer id = 1;
    IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = this.questionTypeOptionMapper.find(id);
    Assert.assertNotNull(questionTypeOptionEntity);
    this.questionTypeOptionMapper.delete(questionTypeOptionEntity);
    questionTypeOptionEntity = this.questionTypeOptionMapper.find(id);
    Assert.assertNull(questionTypeOptionEntity);
}
Also used : IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test)

Example 7 with IssueStandardQuestionTypeOptionEntity

use of easytests.core.entities.IssueStandardQuestionTypeOptionEntity in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsService method map.

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

Example 8 with IssueStandardQuestionTypeOptionEntity

use of easytests.core.entities.IssueStandardQuestionTypeOptionEntity in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsServiceTest method testSaveCreatesEntity.

@Test
public void testSaveCreatesEntity() throws Exception {
    final ArgumentCaptor<IssueStandardQuestionTypeOptionEntity> questionTypeOptionEntityCaptor = ArgumentCaptor.forClass(IssueStandardQuestionTypeOptionEntity.class);
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsSupport.getModelAdditionalMock(0);
    this.questionTypeOptionsService.save(questionTypeOptionModel);
    verify(this.questionTypeOptionsMapper, times(1)).insert(questionTypeOptionEntityCaptor.capture());
    this.questionTypeOptionsSupport.assertEquals(this.questionTypeOptionsSupport.getEntityAdditionalMock(0), questionTypeOptionEntityCaptor.getValue());
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity)

Example 9 with IssueStandardQuestionTypeOptionEntity

use of easytests.core.entities.IssueStandardQuestionTypeOptionEntity 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 10 with IssueStandardQuestionTypeOptionEntity

use of easytests.core.entities.IssueStandardQuestionTypeOptionEntity in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsSupport method getEntityMock.

private IssueStandardQuestionTypeOptionEntity getEntityMock(Integer id, Integer questionType, Integer minQuestions, Integer maxQuestions, Integer timeLimit, Integer issueStandardId) {
    final IssueStandardQuestionTypeOptionEntity issueStandardQuestionTypeOptionEntity = Mockito.mock(IssueStandardQuestionTypeOptionEntity.class);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getId()).thenReturn(id);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getQuestionTypeId()).thenReturn(questionType);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getMinQuestions()).thenReturn(minQuestions);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getMaxQuestions()).thenReturn(maxQuestions);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(issueStandardQuestionTypeOptionEntity.getIssueStandardId()).thenReturn(issueStandardId);
    return issueStandardQuestionTypeOptionEntity;
}
Also used : IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity)

Aggregations

IssueStandardQuestionTypeOptionEntity (easytests.core.entities.IssueStandardQuestionTypeOptionEntity)22 Test (org.junit.Test)14 IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 IssueStandardQuestionTypeOptionsOptionsInterface (easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface)3 ArrayList (java.util.ArrayList)3 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)1 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)1 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1