Search in sources :

Example 16 with IssueStandardQuestionTypeOptionEntity

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

the class IssueStandardQuestionTypeOptionsMapperTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    final Integer id = 4;
    final Integer questionTypeId = 2;
    final Integer minQuestions = 10;
    final Integer maxQuestions = 20;
    final Integer timeLimit = 100;
    final Integer issueStandardId = 2;
    IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = this.questionTypeOptionMapper.find(id);
    Assert.assertNotNull(questionTypeOptionEntity);
    Assert.assertEquals(id, questionTypeOptionEntity.getId());
    Assert.assertNotEquals(questionTypeId, questionTypeOptionEntity.getQuestionTypeId());
    Assert.assertNotEquals(minQuestions, questionTypeOptionEntity.getMinQuestions());
    Assert.assertNotEquals(maxQuestions, questionTypeOptionEntity.getMaxQuestions());
    Assert.assertNotEquals(timeLimit, questionTypeOptionEntity.getTimeLimit());
    Assert.assertEquals(issueStandardId, questionTypeOptionEntity.getIssueStandardId());
    questionTypeOptionEntity = Mockito.mock(IssueStandardQuestionTypeOptionEntity.class);
    Mockito.when(questionTypeOptionEntity.getId()).thenReturn(id);
    Mockito.when(questionTypeOptionEntity.getQuestionTypeId()).thenReturn(questionTypeId);
    Mockito.when(questionTypeOptionEntity.getMinQuestions()).thenReturn(minQuestions);
    Mockito.when(questionTypeOptionEntity.getMaxQuestions()).thenReturn(maxQuestions);
    Mockito.when(questionTypeOptionEntity.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(questionTypeOptionEntity.getIssueStandardId()).thenReturn(issueStandardId);
    this.questionTypeOptionMapper.update(questionTypeOptionEntity);
    questionTypeOptionEntity = this.questionTypeOptionMapper.find(id);
    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 : IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test)

Example 17 with IssueStandardQuestionTypeOptionEntity

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

the class IssueStandardQuestionTypeOptionsMapperTest method testFindByIssueStandard.

@Test
public void testFindByIssueStandard() throws Exception {
    Integer issueStandardId = 1;
    final List<IssueStandardQuestionTypeOptionEntity> questionTypeOptionEntities = this.questionTypeOptionMapper.findByIssueStandardId(issueStandardId);
    Assert.assertEquals(3, questionTypeOptionEntities.size());
    IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = questionTypeOptionEntities.get(2);
    Assert.assertEquals((Integer) 3, questionTypeOptionEntity.getId());
    Assert.assertEquals((Integer) 3, questionTypeOptionEntity.getQuestionTypeId());
    Assert.assertEquals((Integer) 5, questionTypeOptionEntity.getMinQuestions());
    Assert.assertEquals((Integer) 10, questionTypeOptionEntity.getMaxQuestions());
    Assert.assertEquals(null, questionTypeOptionEntity.getTimeLimit());
    Assert.assertEquals((Integer) 1, questionTypeOptionEntity.getIssueStandardId());
}
Also used : IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test)

Example 18 with IssueStandardQuestionTypeOptionEntity

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

the class IssueStandardQuestionTypeOptionsMapperTest method testFind.

@Test
public void testFind() throws Exception {
    final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = this.questionTypeOptionMapper.find(1);
    Assert.assertEquals((Integer) 1, questionTypeOptionEntity.getId());
    Assert.assertEquals((Integer) 1, questionTypeOptionEntity.getQuestionTypeId());
    Assert.assertEquals((Integer) 1, questionTypeOptionEntity.getMinQuestions());
    Assert.assertEquals(null, questionTypeOptionEntity.getMaxQuestions());
    Assert.assertEquals(null, questionTypeOptionEntity.getTimeLimit());
    Assert.assertEquals((Integer) 1, questionTypeOptionEntity.getIssueStandardId());
}
Also used : IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test)

Example 19 with IssueStandardQuestionTypeOptionEntity

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

the class IssueStandardQuestionTypeOptionsServiceTest method mapQuestionTypeOptionEntity.

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

Example 20 with IssueStandardQuestionTypeOptionEntity

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindAllWithOptions.

@Test
public void testFindAllWithOptions() throws Exception {
    final List<IssueStandardQuestionTypeOptionEntity> questionTypeOptionEntities = this.getQuestionTypeOptionEntities();
    final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionModels();
    final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
    given(this.questionTypeOptionsMapper.findAll()).willReturn(questionTypeOptionEntities);
    given(questionTypeOptionsOptions.withRelations(Mockito.anyList())).willReturn(questionTypeOptionModels);
    final List<IssueStandardQuestionTypeOptionModelInterface> foundedQuestionTypeOptionModels = this.questionTypeOptionsService.findAll(questionTypeOptionsOptions);
    verify(questionTypeOptionsOptions).withRelations(questionTypeOptionModels);
    Assert.assertNotNull(foundedQuestionTypeOptionModels);
    Assert.assertEquals(questionTypeOptionModels, foundedQuestionTypeOptionModels);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionsOptionsInterface(easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface) IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

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