use of easytests.core.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testDeleteModelWithOptions.
@Test
public void testDeleteModelWithOptions() throws Exception {
final PointModelInterface pointModel = this.pointsSupport.getModelFixtureMock(0);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
this.pointsService.delete(pointModel, pointsOptions);
this.assertServicesSet(pointsOptions);
verify(pointsOptions, times(1)).deleteWithRelations(pointModel);
verifyNoMoreInteractions(this.pointsMapper);
}
use of easytests.core.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() 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.save(pointsModels, pointsOptions);
this.assertServicesSet(pointsOptions, pointsModels.size());
verify(pointsOptions, times(pointsModels.size())).saveWithRelations(pointModelCaptor.capture());
this.pointsSupport.assertModelsListEquals(pointsModels, pointModelCaptor.getAllValues());
verifyNoMoreInteractions(this.pointsMapper);
}
use of easytests.core.options.PointsOptionsInterface 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);
}
use of easytests.core.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final PointModelInterface pointModel = Models.createPointModel(null, 1, 1);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
this.pointsService.save(pointModel, pointsOptions);
verify(pointsOptions).saveWithRelations(pointModel);
}
Aggregations