use of easytests.core.models.QuizModelInterface 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.models.QuizModelInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testFindByIssueAbsentList.
@Test
public void testFindByIssueAbsentList() throws Exception {
final IssueModelInterface issueModel = Mockito.mock(IssueModelInterface.class);
when(this.quizzesMapper.findByIssueId(issueModel.getId())).thenReturn(new ArrayList<>(0));
final List<QuizModelInterface> quizzesFoundedModels = this.quizzesService.findByIssue(issueModel);
Assert.assertEquals(0, quizzesFoundedModels.size());
}
use of easytests.core.models.QuizModelInterface 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.models.QuizModelInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testSaveCreatesEntity.
@Test
public void testSaveCreatesEntity() throws Exception {
final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
this.quizzesService.save(quizModel);
verify(this.quizzesMapper, times(1)).insert(this.mapQuizEntity(quizModel));
}
use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindByQuizPresentModel.
@Test
public void testFindByQuizPresentModel() throws Exception {
final Integer quizId = 3;
final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(3, "FirstName", "LastName", "Surname", 301, quizId);
given(this.testeesMapper.findByQuizId(quizId)).willReturn(testeeEntity);
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
Mockito.when(quizModel.getId()).thenReturn(quizId);
final TesteeModelInterface testeeModel = this.testeesService.findByQuiz(quizModel);
Assert.assertNotNull(testeeModel);
Assert.assertEquals(this.mapTesteeModel(testeeEntity), testeeModel);
}
Aggregations