Search in sources :

Example 1 with IssueStandardTopicPriorityModelInterface

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

the class IssueStandardTopicPrioritiesServiceTest method testDeleteUnidentifiedModel.

@Test
public void testDeleteUnidentifiedModel() throws Exception {
    final IssueStandardTopicPriorityModelInterface topicPriorityModel = Models.createTopicPriorityModel(null, 2, true, 4);
    exception.expect(DeleteUnidentifiedModelException.class);
    this.topicPrioritiesService.delete(topicPriorityModel);
    verify(this.topicPrioritiesMapper, times(0)).delete(this.mapTopicPriorityEntity(topicPriorityModel));
}
Also used : IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with IssueStandardTopicPriorityModelInterface

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

the class IssueStandardTopicPrioritiesServiceTest method testFindPresentModel.

@Test
public void testFindPresentModel() throws Exception {
    final Integer id = 1;
    final IssueStandardTopicPriorityEntity topicPriorityEntity = Entities.createTopicPriorityEntityMock(id, 2, true, 3);
    given(this.topicPrioritiesMapper.find(id)).willReturn(topicPriorityEntity);
    final IssueStandardTopicPriorityModelInterface topicPriorityModel = this.topicPrioritiesService.find(id);
    Assert.assertNotNull(topicPriorityModel);
    Assert.assertEquals(this.mapTopicPriorityModel(topicPriorityEntity), topicPriorityModel);
}
Also used : IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPriorityEntity(easytests.core.entities.IssueStandardTopicPriorityEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with IssueStandardTopicPriorityModelInterface

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

the class IssueStandardTopicPrioritiesServiceTest method testSaveInsertsEntity.

@Test
public void testSaveInsertsEntity() throws Exception {
    final IssueStandardTopicPriorityModelInterface topicPriorityModel = Models.createTopicPriorityModel(null, 3, true, 5);
    final Integer id = 10;
    doAnswer(invocations -> {
        final IssueStandardTopicPriorityEntity topicPriorityEntity = (IssueStandardTopicPriorityEntity) invocations.getArguments()[0];
        topicPriorityEntity.setId(id);
        return null;
    }).when(this.topicPrioritiesMapper).insert(Mockito.any(IssueStandardTopicPriorityEntity.class));
    this.topicPrioritiesService.save(topicPriorityModel);
    verify(this.topicPrioritiesMapper, times(1)).insert(this.mapTopicPriorityEntity(topicPriorityModel));
    Assert.assertEquals(id, topicPriorityModel.getId());
}
Also used : IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPriorityEntity(easytests.core.entities.IssueStandardTopicPriorityEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with IssueStandardTopicPriorityModelInterface

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

the class IssueStandardTopicPrioritiesServiceTest method mapTopicPriorityModel.

private IssueStandardTopicPriorityModelInterface mapTopicPriorityModel(IssueStandardTopicPriorityEntity topicPriorityEntity) {
    final IssueStandardTopicPriorityModelInterface topicPriorityModel = new IssueStandardTopicPriorityModel();
    topicPriorityModel.map(topicPriorityEntity);
    return topicPriorityModel;
}
Also used : IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPriorityModel(easytests.core.models.IssueStandardTopicPriorityModel)

Example 5 with IssueStandardTopicPriorityModelInterface

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

the class IssueStandardTopicPrioritiesServiceTest method testFindAllWithOptions.

@Test
public void testFindAllWithOptions() throws Exception {
    final List<IssueStandardTopicPriorityEntity> topicPriorityEntities = this.getTopicPriorityEntities();
    final List<IssueStandardTopicPriorityModelInterface> topicPriorityModels = this.getTopicPriorityModels();
    final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = Mockito.mock(IssueStandardTopicPrioritiesOptionsInterface.class);
    given(this.topicPrioritiesMapper.findAll()).willReturn(topicPriorityEntities);
    given(topicPrioritiesOptions.withRelations(Mockito.anyList())).willReturn(topicPriorityModels);
    final List<IssueStandardTopicPriorityModelInterface> foundedTopicPriorityModels = this.topicPrioritiesService.findAll(topicPrioritiesOptions);
    verify(topicPrioritiesOptions).withRelations(topicPriorityModels);
    Assert.assertNotNull(foundedTopicPriorityModels);
    Assert.assertEquals(topicPriorityModels, foundedTopicPriorityModels);
}
Also used : IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPriorityEntity(easytests.core.entities.IssueStandardTopicPriorityEntity) IssueStandardTopicPrioritiesOptionsInterface(easytests.core.options.IssueStandardTopicPrioritiesOptionsInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)33 Test (org.junit.Test)30 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)29 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)9 IssueStandardTopicPriorityEntity (easytests.core.entities.IssueStandardTopicPriorityEntity)7 IssueStandardTopicPrioritiesOptionsInterface (easytests.core.options.IssueStandardTopicPrioritiesOptionsInterface)7 ArrayList (java.util.ArrayList)7 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)5 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)4 IssueStandardTopicPrioritiesServiceInterface (easytests.core.services.IssueStandardTopicPrioritiesServiceInterface)4 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)3 TopicsServiceInterface (easytests.core.services.TopicsServiceInterface)3 IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)2 IssueStandardTopicPriorityModel (easytests.core.models.IssueStandardTopicPriorityModel)2 SubjectModelInterface (easytests.core.models.SubjectModelInterface)2 TopicModelInterface (easytests.core.models.TopicModelInterface)2 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)2 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)2 IssueStandardQuestionTypeOptionsServiceInterface (easytests.core.services.IssueStandardQuestionTypeOptionsServiceInterface)2 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)2