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));
}
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);
}
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());
}
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;
}
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);
}
Aggregations