use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsService method save.
@Override
public void save(PointModelInterface pointModel) {
final PointEntity pointEntity = this.map(pointModel);
if (pointEntity.getId() == null) {
this.pointsMapper.insert(pointEntity);
pointModel.setId(pointEntity.getId());
return;
}
this.pointsMapper.update(pointEntity);
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsService method map.
private PointEntity map(PointModelInterface pointModel) {
final PointEntity pointEntity = new PointEntity();
pointEntity.map(pointModel);
return pointEntity;
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsServiceTest method testFindByQuizWithOptions.
@Test
@Ignore
public void testFindByQuizWithOptions() throws Exception {
final Integer quizId = 5;
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
Mockito.when(quizModel.getId()).thenReturn(quizId);
final PointEntity pointEntityFirst = Entities.createPointEntityMock(1, 1, 1);
final PointEntity pointEntitySecond = Entities.createPointEntityMock(4, 4, 4);
final List<PointEntity> pointsEntities = new ArrayList<>();
pointsEntities.add(pointEntityFirst);
pointsEntities.add(pointEntitySecond);
given(this.pointsMapper.findByQuizId(quizId)).willReturn(pointsEntities);
final List<PointModelInterface> pointsModels = new ArrayList<>();
pointsModels.add(this.mapPointModel(pointEntityFirst));
pointsModels.add(this.mapPointModel(pointEntitySecond));
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptions.class);
given(pointsOptions.withRelations(pointsModels)).willReturn(pointsModels);
final List<PointModelInterface> foundPointsModels = this.pointsService.findByQuiz(quizModel);
verify(this.pointsMapper).findByQuizId(quizId);
verify(pointsOptions).withRelations(pointsModels);
Assert.assertEquals(pointsModels, foundPointsModels);
}
Aggregations