use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesServiceTest method testFindByIssuePresentList.
@Test
public void testFindByIssuePresentList() throws Exception {
final IssueModelInterface issueModel = Mockito.mock(IssueModelInterface.class);
final List<QuizEntity> quizzesEntities = this.getQuizzesFixturesEntities();
when(this.quizzesMapper.findByIssueId(issueModel.getId())).thenReturn(quizzesEntities);
final List<QuizModelInterface> quizzesModels = this.getQuizzesFixturesModels();
final List<QuizModelInterface> quizzesFoundedModels = this.quizzesService.findByIssue(issueModel);
this.quizzesSupport.assertModelsListEquals(quizzesModels, quizzesFoundedModels);
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesServiceTest method testSaveUpdateEntityIdOnCreation.
@Test
public void testSaveUpdateEntityIdOnCreation() throws Exception {
final QuizModelInterface quizAdditionalModel = this.quizzesSupport.getModelAdditionalMock(0);
doAnswer(invocation -> {
final QuizEntity quizEntity = (QuizEntity) invocation.getArguments()[0];
quizEntity.setId(5);
return null;
}).when(this.quizzesMapper).insert(Mockito.any(QuizEntity.class));
this.quizzesService.save(quizAdditionalModel);
verify(quizAdditionalModel, times(1)).setId(5);
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesSupport method getEntityMock.
private QuizEntity getEntityMock(Integer id, Integer issueId, String inviteCode, Boolean codeExpired, LocalDateTime startedAt, LocalDateTime finishedAt) {
final QuizEntity quizEntity = Mockito.mock(QuizEntity.class);
Mockito.when(quizEntity.getId()).thenReturn(id);
Mockito.when(quizEntity.getIssueId()).thenReturn(issueId);
Mockito.when(quizEntity.getInviteCode()).thenReturn(inviteCode);
Mockito.when(quizEntity.getCodeExpired()).thenReturn(codeExpired);
Mockito.when(quizEntity.getStartedAt()).thenReturn(startedAt);
Mockito.when(quizEntity.getFinishedAt()).thenReturn(finishedAt);
return quizEntity;
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesSupport method assertEntitiesListEquals.
public void assertEntitiesListEquals(List<QuizEntity> expected, List<QuizEntity> actual) {
Assert.assertEquals(expected.size(), actual.size());
Integer i = 0;
for (QuizEntity quizEntity : expected) {
this.assertEquals(quizEntity, actual.get(i));
i++;
}
}
use of easytests.core.entities.QuizEntity in project easy-tests by malinink.
the class QuizzesServiceTest method createQuizEntityMock.
private QuizEntity createQuizEntityMock(Integer id, String inviteCode, Integer issueId) {
final QuizEntity quizEntity = Mockito.mock(QuizEntity.class);
Mockito.when(quizEntity.getId()).thenReturn(id);
Mockito.when(quizEntity.getInviteCode()).thenReturn(inviteCode);
Mockito.when(quizEntity.getIssueId()).thenReturn(issueId);
return quizEntity;
}
Aggregations