use of easytests.core.models.QuizModelInterface 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.models.QuizModelInterface 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.models.QuizModelInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testDeleteUnidentifiedModel.
@Test
public void testDeleteUnidentifiedModel() throws Exception {
final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
exception.expect(DeleteUnidentifiedModelException.class);
this.quizzesService.delete(quizModel);
}
use of easytests.core.models.QuizModelInterface 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);
}
use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.
the class QuizzesServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final QuizEntity quizEntity = this.createQuizEntityMock(id, "test", 1);
given(this.quizzesMapper.find(id)).willReturn(quizEntity);
final QuizModelInterface quizModel = this.quizzesService.find(id);
Assert.assertEquals(this.mapQuizModel(quizEntity), quizModel);
}
Aggregations