use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsService method save.
@Override
public void save(SolutionModelInterface solutionModel) {
final SolutionEntity solutionEntity = this.map(solutionModel);
if (solutionEntity.getId() != null) {
this.solutionsMapper.update(solutionEntity);
return;
}
this.solutionsMapper.insert(solutionEntity);
solutionModel.setId(solutionEntity.getId());
}
use of easytests.core.entities.SolutionEntity 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.entities.SolutionEntity 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.entities.SolutionEntity 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);
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsMapperTest method testFind.
@Test
public void testFind() throws Exception {
final SolutionEntity solutionFixtureEntity = this.solutionsSupport.getEntityFixtureMock(0);
final SolutionEntity solutionFoundedEntity = this.solutionsMapper.find(solutionFixtureEntity.getId());
this.solutionsSupport.assertEquals(solutionFixtureEntity, solutionFoundedEntity);
}
Aggregations