use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsMapperTest method testDelete.
@Test
public void testDelete() throws Exception {
final Integer id = this.solutionsSupport.getEntityFixtureMock(0).getId();
final SolutionEntity solutionFoundedEntity = this.solutionsMapper.find(id);
Assert.assertNotNull(solutionFoundedEntity);
this.solutionsMapper.delete(solutionFoundedEntity);
Assert.assertNull(this.solutionsMapper.find(id));
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsMapperTest method testUpdate.
@Test
public void testUpdate() throws Exception {
final SolutionEntity solutionChangedEntity = this.solutionsSupport.getEntityAdditionalMock(1);
final SolutionEntity solutionBeforeUpdateEntity = this.solutionsMapper.find(solutionChangedEntity.getId());
Assert.assertNotNull(solutionBeforeUpdateEntity);
this.solutionsSupport.assertNotEqualsWithoutId(solutionChangedEntity, solutionBeforeUpdateEntity);
this.solutionsMapper.update(solutionChangedEntity);
final SolutionEntity solutionUpdatedEntity = this.solutionsMapper.find(solutionChangedEntity.getId());
this.solutionsSupport.assertEquals(solutionChangedEntity, solutionUpdatedEntity);
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsService method map.
private SolutionEntity map(SolutionModelInterface solutionModel) {
final SolutionEntity solutionEntity = new SolutionEntity();
solutionEntity.map(solutionModel);
return solutionEntity;
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsServiceTest method testFindByPointPresentModel.
@Test
public void testFindByPointPresentModel() throws Exception {
Integer pointId = 1;
final List<SolutionEntity> solutionEntities = new ArrayList<>(2);
solutionEntities.add(this.createSolutionEntityMock(1, 10, pointId));
solutionEntities.add(this.createSolutionEntityMock(2, 20, pointId));
given(this.solutionsMapper.findByPointId(pointId)).willReturn(solutionEntities);
final PointModelInterface pointModel = mock(PointModelInterface.class);
when(pointModel.getId()).thenReturn(pointId);
final List<SolutionModelInterface> solutionModels = this.solutionsService.findByPoint(pointModel);
Assert.assertNotNull(solutionModels);
Assert.assertEquals(solutionEntities.size(), solutionModels.size());
for (int i = 0; i < solutionEntities.size(); i++) {
Assert.assertEquals(solutionModels.get(i), this.mapSolutionModel(solutionEntities.get(i)));
}
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveInsertsEntity.
@Test
public void testSaveInsertsEntity() throws Exception {
final SolutionModelInterface solutionModel = this.createSolutionModel(null, 13, 4);
final Integer id = 5;
doAnswer(invocations -> {
final SolutionEntity solutionEntity = (SolutionEntity) invocations.getArguments()[0];
solutionEntity.setId(id);
return null;
}).when(this.solutionsMapper).insert(Mockito.any(SolutionEntity.class));
this.solutionsService.save(solutionModel);
verify(this.solutionsMapper, times(1)).insert(this.mapSolutionEntity(solutionModel));
Assert.assertEquals(id, solutionModel.getId());
}
Aggregations