use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() throws Exception {
final ArgumentCaptor<SolutionModelInterface> solutionModelCaptor = ArgumentCaptor.forClass(SolutionModelInterface.class);
final List<SolutionModelInterface> solutionsModels = this.getSolutionsFixturesModels();
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.save(solutionsModels, solutionsOptions);
this.assertServicesSet(solutionsOptions, solutionsModels.size());
verify(solutionsOptions, times(solutionsModels.size())).saveWithRelations(solutionModelCaptor.capture());
this.solutionsSupport.assertModelsListEquals(solutionsModels, solutionModelCaptor.getAllValues());
verifyNoMoreInteractions(this.solutionsMapper);
}
use of easytests.core.options.SolutionsOptionsInterface 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.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final SolutionModelInterface solutionModel = this.createSolutionModel(1, 1, 1);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.delete(solutionModel, solutionsOptions);
verify(solutionsOptions).deleteWithRelations(solutionModel);
}
use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final SolutionEntity solutionEntity = this.createSolutionEntityMock(id, 1, 1);
final SolutionModelInterface solutionModel = this.mapSolutionModel(solutionEntity);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
given(this.solutionsMapper.find(id)).willReturn(solutionEntity);
given(solutionsOptions.withRelations(solutionModel)).willReturn(solutionModel);
final SolutionModelInterface foundedSolutionModel = this.solutionsService.find(id, solutionsOptions);
Assert.assertEquals(solutionModel, foundedSolutionModel);
verify(solutionsOptions).withRelations(solutionModel);
}
use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<SolutionModelInterface> solutionModelCaptor = ArgumentCaptor.forClass(SolutionModelInterface.class);
final List<SolutionModelInterface> solutionsModels = this.getSolutionsFixturesModels();
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.delete(solutionsModels, solutionsOptions);
this.assertServicesSet(solutionsOptions, solutionsModels.size());
verify(solutionsOptions, times(solutionsModels.size())).deleteWithRelations(solutionModelCaptor.capture());
this.solutionsSupport.assertModelsListEquals(solutionsModels, solutionModelCaptor.getAllValues());
verifyNoMoreInteractions(this.solutionsMapper);
}
Aggregations