Search in sources :

Example 1 with IssueStandardTopicPriorityEntity

use of easytests.core.entities.IssueStandardTopicPriorityEntity 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 2 with IssueStandardTopicPriorityEntity

use of easytests.core.entities.IssueStandardTopicPriorityEntity 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 3 with IssueStandardTopicPriorityEntity

use of easytests.core.entities.IssueStandardTopicPriorityEntity 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)

Example 4 with IssueStandardTopicPriorityEntity

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

the class IssueStandardTopicPrioritiesServiceTest method testFindWithOptions.

@Test
public void testFindWithOptions() throws Exception {
    final Integer id = 1;
    final IssueStandardTopicPriorityEntity topicPriorityEntity = Entities.createTopicPriorityEntityMock(id, 2, true, 3);
    final IssueStandardTopicPriorityModelInterface topicPriorityModel = this.mapTopicPriorityModel(topicPriorityEntity);
    final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = Mockito.mock(IssueStandardTopicPrioritiesOptionsInterface.class);
    given(this.topicPrioritiesMapper.find(id)).willReturn(topicPriorityEntity);
    given(topicPrioritiesOptions.withRelations(topicPriorityModel)).willReturn(topicPriorityModel);
    final IssueStandardTopicPriorityModelInterface foundedTopicPriorityModels = this.topicPrioritiesService.find(id, topicPrioritiesOptions);
    verify(topicPrioritiesOptions).withRelations(topicPriorityModel);
    Assert.assertNotNull(foundedTopicPriorityModels);
    Assert.assertEquals(topicPriorityModel, 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)

Example 5 with IssueStandardTopicPriorityEntity

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

the class IssueStandardTopicPrioritiesServiceTest method testFindByIssueStandardWithOptions.

@Test
public void testFindByIssueStandardWithOptions() throws Exception {
    Integer issueStandardId = 10;
    final List<IssueStandardTopicPriorityEntity> topicPriorityEntities = new ArrayList<>(2);
    topicPriorityEntities.add(Entities.createTopicPriorityEntityMock(1, 2, true, issueStandardId));
    topicPriorityEntities.add(Entities.createTopicPriorityEntityMock(3, 4, true, issueStandardId));
    final List<IssueStandardTopicPriorityModelInterface> topicPriorityModels = new ArrayList<>(2);
    topicPriorityModels.add(this.mapTopicPriorityModel(topicPriorityEntities.get(0)));
    topicPriorityModels.add(this.mapTopicPriorityModel(topicPriorityEntities.get(1)));
    final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = Mockito.mock(IssueStandardTopicPrioritiesOptionsInterface.class);
    given(this.topicPrioritiesMapper.findByIssueStandardId(issueStandardId)).willReturn(topicPriorityEntities);
    given(topicPrioritiesOptions.withRelations(topicPriorityModels)).willReturn(topicPriorityModels);
    final List<IssueStandardTopicPriorityModelInterface> foundedTopicPriorityModels = this.topicPrioritiesService.findByIssueStandard(topicPriorityModels.get(0).getIssueStandard(), 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) ArrayList(java.util.ArrayList) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssueStandardTopicPriorityEntity (easytests.core.entities.IssueStandardTopicPriorityEntity)12 Test (org.junit.Test)8 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 IssueStandardTopicPrioritiesOptionsInterface (easytests.core.options.IssueStandardTopicPrioritiesOptionsInterface)3 ArrayList (java.util.ArrayList)3 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)1 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)1 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)1 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1