use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final SolutionModelInterface solutionModel = this.solutionsSupport.getModelFixtureMock(0);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
this.solutionsService.save(solutionModel, solutionsOptions);
this.assertServicesSet(solutionsOptions);
verify(solutionsOptions, times(1)).saveWithRelations(solutionModel);
verifyNoMoreInteractions(this.solutionsMapper);
}
use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final List<SolutionEntity> solutionsEntities = this.getSolutionsEntities();
final List<SolutionModelInterface> solutionsModels = this.getSolutionsModels(solutionsEntities);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
given(this.solutionsMapper.findAll()).willReturn(solutionsEntities);
given(solutionsOptions.withRelations(Mockito.anyList())).willReturn(solutionsModels);
final List<SolutionModelInterface> foundedSolutionsModels = this.solutionsService.findAll(solutionsOptions);
verify(solutionsOptions).withRelations(solutionsModels);
Assert.assertEquals(solutionsModels, foundedSolutionsModels);
}
use of easytests.core.options.SolutionsOptionsInterface in project easy-tests by malinink.
the class SolutionsServiceTest method testSaveEntitiesList.
@Test
public void testSaveEntitiesList() throws Exception {
final SolutionModelInterface solutionModelFirst = this.createSolutionModel(1, 13, 4);
final SolutionModelInterface solutionModelSecond = this.createSolutionModel(2, 10, 3);
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
final List<SolutionModelInterface> solutionModels = new ArrayList<>();
solutionModels.add(solutionModelFirst);
solutionModels.add(solutionModelSecond);
final SolutionsServiceInterface solutionsServiceSpy = Mockito.spy(solutionsService);
solutionsServiceSpy.save(solutionModels);
verify(solutionsServiceSpy, times(1)).save(solutionModelFirst);
verify(solutionsServiceSpy, times(1)).save(solutionModelSecond);
solutionsServiceSpy.save(solutionModels, solutionsOptions);
verify(solutionsServiceSpy, times(1)).save(solutionModelFirst, solutionsOptions);
verify(solutionsServiceSpy, times(1)).save(solutionModelSecond, solutionsOptions);
}
Aggregations