use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsServiceTest method testFindByQuizPresentList.
@Test
public void testFindByQuizPresentList() throws Exception {
final QuizModelInterface quizModel = this.quizzesSupport.getModelFixtureMock(0);
final List<PointEntity> pointsEntities = this.getPointsFixturesEntities();
when(this.pointsMapper.findByQuizId(quizModel.getId())).thenReturn(pointsEntities);
final List<PointModelInterface> pointsFoundedModels = this.pointsService.findByQuiz(quizModel);
this.pointsSupport.assertModelsListEquals(this.getPointsFixturesModels(), pointsFoundedModels);
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsSupport method assertEntitiesListEquals.
public void assertEntitiesListEquals(List<PointEntity> expected, List<PointEntity> actual) {
Assert.assertEquals(expected.size(), actual.size());
Integer i = 0;
for (PointEntity pointEntity : expected) {
this.assertEquals(pointEntity, actual.get(i));
i++;
}
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<PointEntity> pointsFoundedEntities = this.pointsMapper.findAll();
Assert.assertEquals(3, pointsFoundedEntities.size());
Integer index = 0;
for (PointEntity pointEntity : pointsFoundedEntities) {
final PointEntity pointFixtureEntity = this.pointsSupport.getEntityFixtureMock(index);
this.pointsSupport.assertEquals(pointFixtureEntity, pointEntity);
index++;
}
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final Integer questionId = 1;
final Integer quizId = 2;
final PointEntity pointEntity = Entities.createPointEntityMock(4, questionId, quizId);
final PointModelInterface pointModel = this.mapPointModel(pointEntity);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
given(this.pointsMapper.find(id)).willReturn(pointEntity);
given(pointsOptions.withRelations(pointModel)).willReturn(pointModel);
final PointModelInterface foundPointModel = this.pointsService.find(id, pointsOptions);
verify(pointsOptions).withRelations(pointModel);
Assert.assertEquals(pointModel, foundPointModel);
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsServiceTest method getPointsEntities.
private List<PointEntity> getPointsEntities() {
final List<PointEntity> pointEntities = new ArrayList<>(2);
final PointEntity pointEntityFirst = Entities.createPointEntityMock(1, 1, 1);
final PointEntity pointEntitySecond = Entities.createPointEntityMock(2, 2, 2);
pointEntities.add(pointEntityFirst);
pointEntities.add(pointEntitySecond);
return pointEntities;
}
Aggregations