use of easytests.core.models.IssueStandardTopicPriorityModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesOptionsTest method testSaveWithRelations.
@Test
public void testSaveWithRelations() throws Exception {
final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = new IssueStandardTopicPrioritiesOptions();
final IssueStandardTopicPrioritiesServiceInterface topicPrioritiesService = Mockito.mock(IssueStandardTopicPrioritiesServiceInterface.class);
final IssueStandardsServiceInterface issueStandardsService = Mockito.mock(IssueStandardsServiceInterface.class);
final IssueStandardsOptionsInterface issueStandardsOptions = Mockito.mock(IssueStandardsOptionsInterface.class);
final Integer issueStandardId = 10;
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
final IssueStandardTopicPriorityModelInterface topicPriorityModel = Mockito.mock(IssueStandardTopicPriorityModelInterface.class);
Mockito.when(topicPriorityModel.getIssueStandard()).thenReturn(issueStandardModel);
topicPrioritiesOptions.setTopicPrioritiesService(topicPrioritiesService);
topicPrioritiesOptions.setIssueStandardsService(issueStandardsService);
topicPrioritiesOptions.withIssueStandard(issueStandardsOptions);
final InOrder inOrder = Mockito.inOrder(issueStandardsService, topicPrioritiesService);
topicPrioritiesOptions.saveWithRelations(topicPriorityModel);
inOrder.verify(issueStandardsService).save(topicPriorityModel.getIssueStandard(), issueStandardsOptions);
inOrder.verify(topicPrioritiesService).save(topicPriorityModel);
}
use of easytests.core.models.IssueStandardTopicPriorityModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesService method map.
private IssueStandardTopicPriorityModelInterface map(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 IssueStandardDtoValidator method validateTopicPriorityDtoIdBelongsToIssueStandard.
private void validateTopicPriorityDtoIdBelongsToIssueStandard(Errors errors, IssueStandardDto issueStandardDto) {
final List<IssueStandardTopicPriorityModelInterface> tpModels = this.topicPrioritiesService.findByIssueStandard(new IssueStandardModelEmpty(issueStandardDto.getId()));
final List<Integer> tpModelIds = new ArrayList<>(tpModels.size());
tpModelIds.addAll(tpModels.stream().map(IdentityInterface::getId).collect(Collectors.toList()));
int index = 0;
for (IssueStandardTopicPriorityDto tpDto : issueStandardDto.getTopicPriorities()) {
if (tpDto.getId() != null && !tpModelIds.contains(tpDto.getId())) {
reject(errors, tpField(index, "id"), "Foreign topicPriority id for IssueStandard entity");
}
index++;
}
}
use of easytests.core.models.IssueStandardTopicPriorityModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final Integer issueStandardId = 1;
final IssueStandardTopicPriorityModelInterface topicPriorityModel = Models.createTopicPriorityModel(id, 1, true, issueStandardId);
final IssueStandardModelInterface issueStandardModel = Models.createIssueStandardModel(issueStandardId, 300, 30, 1);
topicPriorityModel.setIssueStandard(issueStandardModel);
final IssueStandardTopicPriorityModelInterface foundedTopicPriorityModel = this.topicPrioritiesService.find(id, new IssueStandardTopicPrioritiesOptions().withIssueStandard(new IssueStandardsOptions()));
Assert.assertEquals(topicPriorityModel, foundedTopicPriorityModel);
Assert.assertEquals(issueStandardModel, foundedTopicPriorityModel.getIssueStandard());
}
use of easytests.core.models.IssueStandardTopicPriorityModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesServiceTest method testDeleteListWithOptions.
@Test
public void testDeleteListWithOptions() throws Exception {
final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = Mockito.mock(IssueStandardTopicPrioritiesOptionsInterface.class);
final List<IssueStandardTopicPriorityModelInterface> topicPriorityModels = this.getTopicPriorityModels();
this.topicPrioritiesService.delete(topicPriorityModels, topicPrioritiesOptions);
for (IssueStandardTopicPriorityModelInterface topicPriorityModel : topicPriorityModels) {
verify(topicPrioritiesOptions).deleteWithRelations(topicPriorityModel);
}
}
Aggregations