use of easytests.core.options.PointsOptionsInterface 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.options.PointsOptionsInterface 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.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testDeleteModelsList.
@Test
@Ignore
public void testDeleteModelsList() throws Exception {
final PointModelInterface pointModelFirst = Models.createPointModel(2, 2, 2);
final PointModelInterface pointModelSecond = Models.createPointModel(3, 3, 3);
final List<PointModelInterface> pointsModels = new ArrayList<>();
pointsModels.add(pointModelFirst);
pointsModels.add(pointModelSecond);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
final PointsServiceInterface pointsServiceSpy = Mockito.spy(pointsService);
pointsServiceSpy.delete(pointsModels);
verify(pointsServiceSpy, times(1)).delete(pointModelFirst);
verify(pointsServiceSpy, times(1)).delete(pointModelSecond);
pointsServiceSpy.delete(pointsModels);
verify(pointsServiceSpy, times(1)).delete(pointModelFirst, pointsOptions);
verify(pointsServiceSpy, times(1)).delete(pointModelSecond, pointsOptions);
}
use of easytests.core.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final PointModelInterface pointModel = Models.createPointModel(null, 1, 1);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
this.pointsService.delete(pointModel, pointsOptions);
verify(pointsOptions).deleteWithRelations(pointModel);
}
use of easytests.core.options.PointsOptionsInterface in project easy-tests by malinink.
the class PointsServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final List<PointEntity> pointsEntities = this.getPointsEntities();
final List<PointModelInterface> pointsModels = this.getPointsModels();
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
given(this.pointsMapper.findAll()).willReturn(pointsEntities);
given(pointsOptions.withRelations(Mockito.anyList())).willReturn(pointsModels);
final List<PointModelInterface> foundPointsModels = this.pointsService.findAll(pointsOptions);
verify(pointsOptions).withRelations(foundPointsModels);
Assert.assertEquals(pointsModels, foundPointsModels);
}
Aggregations