use of easytests.core.models.SolutionModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveUpdateEntityIdOnCreation.
@Test
public void testSaveUpdateEntityIdOnCreation() throws Exception {
final Integer id = 5;
final SolutionModelInterface solutionModel = this.solutionsSupport.getModelAdditionalMock(0);
doAnswer(invocation -> {
final SolutionEntity solutionEntity = (SolutionEntity) invocation.getArguments()[0];
solutionEntity.setId(id);
return null;
}).when(this.solutionsMapper).insert(any());
this.solutionsService.save(solutionModel);
verify(solutionModel, times(1)).setId(id);
}
use of easytests.core.models.SolutionModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveCreatesEntity.
@Test
public void testSaveCreatesEntity() throws Exception {
final ArgumentCaptor<SolutionEntity> solutionEntityCaptor = ArgumentCaptor.forClass(SolutionEntity.class);
final SolutionModelInterface solutionModel = this.solutionsSupport.getModelAdditionalMock(0);
this.solutionsService.save(solutionModel);
verify(this.solutionsMapper, times(1)).insert(solutionEntityCaptor.capture());
this.solutionsSupport.assertEquals(this.solutionsSupport.getEntityAdditionalMock(0), solutionEntityCaptor.getValue());
}
use of easytests.core.models.SolutionModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<SolutionModelInterface> solutionModelCaptor = ArgumentCaptor.forClass(SolutionModelInterface.class);
final List<SolutionModelInterface> solutionsModels = this.getSolutionsFixturesModels();
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.delete(solutionsModels, solutionsOptions);
this.assertServicesSet(solutionsOptions, solutionsModels.size());
verify(solutionsOptions, times(solutionsModels.size())).deleteWithRelations(solutionModelCaptor.capture());
this.solutionsSupport.assertModelsListEquals(solutionsModels, solutionModelCaptor.getAllValues());
verifyNoMoreInteractions(this.solutionsMapper);
}
use of easytests.core.models.SolutionModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final SolutionModelInterface solutionModel = this.solutionsSupport.getModelFixtureMock(0);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.save(solutionModel, solutionsOptions);
this.assertServicesSet(solutionsOptions);
verify(solutionsOptions, times(1)).saveWithRelations(solutionModel);
verifyNoMoreInteractions(this.solutionsMapper);
}
use of easytests.core.models.SolutionModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testFindByPointPresentList.
@Test
public void testFindByPointPresentList() throws Exception {
final PointModelInterface pointModel = this.pointsSupport.getModelFixtureMock(0);
final List<SolutionEntity> solutionsEntities = this.getSolutionsFixturesEntities();
when(this.solutionsMapper.findByPointId(pointModel.getId())).thenReturn(solutionsEntities);
final List<SolutionModelInterface> solutionsFoundedModels = this.solutionsService.findByPoint(pointModel);
this.solutionsSupport.assertModelsListEquals(this.getSolutionsFixturesModels(), solutionsFoundedModels);
}
Aggregations