use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testSaveEntitiesList.
@Test
public void testSaveEntitiesList() throws Exception {
final QuizModelInterface quizModelFirst = this.createQuizModel(null, "test1", 1);
final QuizModelInterface quizModelSecond = this.createQuizModel(null, "test2", 2);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
final List<QuizModelInterface> quizzesModels = new ArrayList<>();
quizzesModels.add(quizModelFirst);
quizzesModels.add(quizModelSecond);
final QuizzesServiceInterface quizzesServiceSpy = Mockito.spy(quizzesService);
quizzesServiceSpy.save(quizzesModels);
verify(quizzesServiceSpy, times(1)).save(quizModelFirst);
verify(quizzesServiceSpy, times(1)).save(quizModelSecond);
quizzesServiceSpy.save(quizzesModels, quizzesOptions);
verify(quizzesServiceSpy, times(1)).save(quizModelFirst, quizzesOptions);
verify(quizzesServiceSpy, times(1)).save(quizModelSecond, quizzesOptions);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final List<QuizEntity> quizzesEntities = this.getQuizzesEntities();
final List<QuizModelInterface> quizzesModels = this.getIssuesModels();
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
given(this.quizzesMapper.findAll()).willReturn(quizzesEntities);
given(quizzesOptions.withRelations(Mockito.anyList())).willReturn(quizzesModels);
final List<QuizModelInterface> foundedQuizzesModels = this.quizzesService.findAll(quizzesOptions);
verify(quizzesOptions).withRelations(foundedQuizzesModels);
Assert.assertEquals(quizzesModels, foundedQuizzesModels);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testDeleteModelsList.
@Test
public void testDeleteModelsList() throws Exception {
final QuizModelInterface quizModelFirst = this.createQuizModel(2, "test2", 1);
final QuizModelInterface quizModelSecond = this.createQuizModel(3, "test3", 2);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
final List<QuizModelInterface> quizzesModels = new ArrayList<>();
quizzesModels.add(quizModelFirst);
quizzesModels.add(quizModelSecond);
final QuizzesServiceInterface quizzesServiceSpy = Mockito.spy(quizzesService);
quizzesServiceSpy.delete(quizzesModels);
verify(quizzesServiceSpy, times(1)).delete(quizModelFirst);
verify(quizzesServiceSpy, times(1)).delete(quizModelSecond);
quizzesServiceSpy.delete(quizzesModels, quizzesOptions);
verify(quizzesServiceSpy, times(1)).delete(quizModelFirst, quizzesOptions);
verify(quizzesServiceSpy, times(1)).delete(quizModelSecond, quizzesOptions);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
this.quizzesService.save(quizModel, quizzesOptions);
verify(quizzesOptions).saveWithRelations(quizModel);
}
Aggregations