Search in sources :

Example 31 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindAbsentModel.

@Test
public void testFindAbsentModel() throws Exception {
    final Integer id = 10;
    given(this.questionTypeOptionsMapper.find(id)).willReturn(null);
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsService.find(id);
    Assert.assertNull(questionTypeOptionModel);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 32 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testSaveListWithOptions.

@Test
public void testSaveListWithOptions() throws Exception {
    final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
    final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionModels();
    this.questionTypeOptionsService.save(questionTypeOptionModels, questionTypeOptionsOptions);
    for (IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel : questionTypeOptionModels) {
        verify(questionTypeOptionsOptions).saveWithRelations(questionTypeOptionModel);
    }
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionsOptionsInterface(easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 33 with IssueStandardQuestionTypeOptionModelInterface

use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface 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)

Example 34 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindPresentModel.

@Test
public void testFindPresentModel() throws Exception {
    final Integer id = 1;
    final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = Entities.createQuestionTypeOptionEntityMock(id, 1, 10, 20, 60, 1);
    given(this.questionTypeOptionsMapper.find(id)).willReturn(questionTypeOptionEntity);
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsService.find(id);
    Assert.assertNotNull(questionTypeOptionModel);
    Assert.assertEquals(this.mapQuestionTypeOptionModel(questionTypeOptionEntity), questionTypeOptionModel);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionEntity(easytests.core.entities.IssueStandardQuestionTypeOptionEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 35 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindByIssueStandardAbsentList.

@Test
public void testFindByIssueStandardAbsentList() throws Exception {
    final Integer issueStandardId = 10;
    given(this.questionTypeOptionsMapper.findByIssueStandardId(issueStandardId)).willReturn(new ArrayList<>(0));
    final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
    Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
    final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.questionTypeOptionsService.findByIssueStandard(issueStandardModel);
    Assert.assertNotNull(questionTypeOptionModels);
    Assert.assertEquals(0, questionTypeOptionModels.size());
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

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