use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() throws Exception {
final ArgumentCaptor<PointModelInterface> pointModelCaptor = ArgumentCaptor.forClass(PointModelInterface.class);
final List<PointModelInterface> pointsModels = this.getPointsFixturesModels();
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
this.pointsService.save(pointsModels, pointsOptions);
this.assertServicesSet(pointsOptions, pointsModels.size());
verify(pointsOptions, times(pointsModels.size())).saveWithRelations(pointModelCaptor.capture());
this.pointsSupport.assertModelsListEquals(pointsModels, pointModelCaptor.getAllValues());
verifyNoMoreInteractions(this.pointsMapper);
}
use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsServiceTest method testSaveUpdateEntityIdOnCreation.
@Test
public void testSaveUpdateEntityIdOnCreation() throws Exception {
final Integer id = 5;
final PointModelInterface pointModel = this.pointsSupport.getModelAdditionalMock(0);
doAnswer(invocation -> {
final PointEntity answerEntity = (PointEntity) invocation.getArguments()[0];
answerEntity.setId(id);
return null;
}).when(this.pointsMapper).insert(any());
this.pointsService.save(pointModel);
verify(pointModel, times(1)).setId(id);
}
use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsServiceTest method testFindAbsentModel.
@Test
public void testFindAbsentModel() throws Exception {
final Integer absentId = 10;
when(this.pointsMapper.find(absentId)).thenReturn(null);
final PointModelInterface pointFoundedModel = this.pointsService.find(absentId);
Assert.assertNull(pointFoundedModel);
}
use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testFindByPointAbsentList.
@Test
public void testFindByPointAbsentList() throws Exception {
final PointModelInterface pointModel = this.pointsSupport.getModelFixtureMock(0);
when(this.solutionsMapper.findByPointId(pointModel.getId())).thenReturn(new ArrayList<>(0));
final List<SolutionModelInterface> solutionsFoundedModels = this.solutionsService.findByPoint(pointModel);
Assert.assertEquals(0, solutionsFoundedModels.size());
}
use of easytests.core.models.PointModelInterface 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