use of easytests.core.entities.QuizEntity 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);
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesServiceTest method testFindByIssue.
@Test
public void testFindByIssue() 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);
Mockito.when(issueModel.getId()).thenReturn(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 List<QuizModelInterface> foundedQuizzesModels = this.quizzesService.findByIssue(issueModel);
verify(this.quizzesMapper).findByIssueId(issueId);
Assert.assertEquals(quizzesModels, foundedQuizzesModels);
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesMapperTest method testFindByIssueId.
@Test
public void testFindByIssueId() throws Exception {
final List<QuizEntity> quizzesFixtureEntities = new ArrayList<>();
quizzesFixtureEntities.add(this.quizzesSupport.getEntityFixtureMock(1));
final List<QuizEntity> quizzesFoundedEntities = this.quizzesMapper.findByIssueId(2);
Assert.assertEquals(1, quizzesFoundedEntities.size());
Integer index = 0;
for (QuizEntity quizEntity : quizzesFoundedEntities) {
this.quizzesSupport.assertEquals(quizzesFixtureEntities.get(index), quizEntity);
index++;
}
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<QuizEntity> quizFoundedEntities = this.quizzesMapper.findAll();
Assert.assertEquals(3, quizFoundedEntities.size());
Integer index = 0;
for (QuizEntity quizEntity : quizFoundedEntities) {
final QuizEntity quizFixtureEntity = this.quizzesSupport.getEntityFixtureMock(index);
this.quizzesSupport.assertEquals(quizFixtureEntity, quizEntity);
index++;
}
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesService method map.
private QuizEntity map(QuizModelInterface quizModel) {
final QuizEntity quizEntity = new QuizEntity();
quizEntity.map(quizModel);
return quizEntity;
}
Aggregations