use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsServiceTest method testFindByQuizAbsentList.
@Test
public void testFindByQuizAbsentList() throws Exception {
final QuizModelInterface quizModel = this.quizzesSupport.getModelFixtureMock(0);
when(this.pointsMapper.findByQuizId(quizModel.getId())).thenReturn(new ArrayList<>(0));
final List<PointModelInterface> pointFoundedModels = this.pointsService.findByQuiz(quizModel);
Assert.assertEquals(0, pointFoundedModels.size());
}
use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() 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.delete(pointsModels, pointsOptions);
this.assertServicesSet(pointsOptions, pointsModels.size());
verify(pointsOptions, times(pointsModels.size())).deleteWithRelations(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 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.models.PointModelInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testFindByPointWithOptions.
@Test
public void testFindByPointWithOptions() throws Exception {
final ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class);
final PointModelInterface pointModel = this.pointsSupport.getModelFixtureMock(0);
final List<SolutionEntity> solutionsEntities = this.getSolutionsFixturesEntities();
when(this.solutionsMapper.findByPointId(pointModel.getId())).thenReturn(solutionsEntities);
final List<SolutionModelInterface> solutionsModels = this.getSolutionsFixturesModels();
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
when(solutionsOptions.withRelations(listCaptor.capture())).thenReturn(solutionsModels);
final List<SolutionModelInterface> solutionsFoundedModels = this.solutionsService.findByPoint(pointModel, solutionsOptions);
this.assertServicesSet(solutionsOptions);
this.solutionsSupport.assertModelsListEquals(solutionsModels, listCaptor.getValue());
Assert.assertSame(solutionsModels, solutionsFoundedModels);
}
use of easytests.core.models.PointModelInterface in project easy-tests by malinink.
the class PointsSupport method assertModelsListEquals.
public void assertModelsListEquals(List<PointModelInterface> expected, List<PointModelInterface> actual) {
Assert.assertEquals(expected.size(), actual.size());
Integer i = 0;
for (PointModelInterface pointModel : expected) {
this.assertEquals(pointModel, actual.get(i));
i++;
}
}
Aggregations