use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() throws Exception {
final ArgumentCaptor<QuizModelInterface> quizModelCaptor = ArgumentCaptor.forClass(QuizModelInterface.class);
final List<QuizModelInterface> quizzesModels = this.getQuizzesFixturesModels();
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
this.quizzesService.save(quizzesModels, quizzesOptions);
this.assertServicesSet(quizzesOptions, quizzesModels.size());
verify(quizzesOptions, times(quizzesModels.size())).saveWithRelations(quizModelCaptor.capture());
this.quizzesSupport.assertModelsListEquals(quizzesModels, quizModelCaptor.getAllValues());
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<QuizModelInterface> quizModelCaptor = ArgumentCaptor.forClass(QuizModelInterface.class);
final List<QuizModelInterface> quizzesModels = this.getQuizzesFixturesModels();
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
this.quizzesService.delete(quizzesModels, quizzesOptions);
this.assertServicesSet(quizzesOptions, quizzesModels.size());
verify(quizzesOptions, times(quizzesModels.size())).deleteWithRelations(quizModelCaptor.capture());
this.quizzesSupport.assertModelsListEquals(quizzesModels, quizModelCaptor.getAllValues());
verifyNoMoreInteractions(this.quizzesMapper);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
this.quizzesService.delete(quizModel, quizzesOptions);
verify(quizzesOptions).deleteWithRelations(quizModel);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testFindByIssueWithOptions.
@Test
public void testFindByIssueWithOptions() throws Exception {
final Integer issueId = 7;
final IssueModelInterface issueModel = Mockito.mock(IssueModelInterface.class);
final QuizEntity quizEntityFirst = this.createQuizEntityMock(3, "test3", issueId);
final QuizEntity quizEntitySecond = this.createQuizEntityMock(12, "test12", issueId);
final List<QuizEntity> quizzesEntities = new ArrayList<>();
quizzesEntities.add(quizEntityFirst);
quizzesEntities.add(quizEntitySecond);
given(issueModel.getId()).willReturn(issueId);
given(this.quizzesMapper.findByIssueId(issueId)).willReturn(quizzesEntities);
final List<QuizModelInterface> quizzesModels = new ArrayList<>();
quizzesModels.add(this.mapQuizModel(quizEntityFirst));
quizzesModels.add(this.mapQuizModel(quizEntitySecond));
final QuizzesOptionsInterface quizOptions = Mockito.mock(QuizzesOptionsInterface.class);
given(quizOptions.withRelations(quizzesModels)).willReturn(quizzesModels);
final List<QuizModelInterface> foundedQuizzesModels = this.quizzesService.findByIssue(issueModel, quizOptions);
verify(this.quizzesMapper).findByIssueId(issueId);
verify(quizOptions).withRelations(quizzesModels);
Assert.assertEquals(quizzesModels, foundedQuizzesModels);
}
use of easytests.core.options.QuizzesOptionsInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final Integer issueId = 1;
final QuizEntity quizEntity = this.createQuizEntityMock(4, "test3", issueId);
final QuizModelInterface quizModel = this.mapQuizModel(quizEntity);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
given(this.quizzesMapper.find(id)).willReturn(quizEntity);
given(quizzesOptions.withRelations(quizModel)).willReturn(quizModel);
final QuizModelInterface foundedQuizModel = this.quizzesService.find(id, quizzesOptions);
Assert.assertEquals(quizModel, foundedQuizModel);
verify(quizzesOptions).withRelations(quizModel);
}
Aggregations