use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersServiceTest method testFindByPresentQuestion.
@Test
public void testFindByPresentQuestion() throws Exception {
final List<AnswerModelInterface> answersModels = getAnswersFixturesModels();
final List<AnswerEntity> answersEntities = getAnswersFixturesEntities();
when(this.answersMapper.findByQuestionId(answersModels.get(0).getQuestion().getId())).thenReturn(answersEntities);
final List<AnswerModelInterface> answersFoundedModels = this.answersService.findByQuestion(answersModels.get(0).getQuestion());
Integer index = 0;
for (AnswerModelInterface answerModel1 : answersFoundedModels) {
this.answersSupport.assertEquals(answerModel1, answersEntities.get(index));
index++;
}
}
use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<AnswerEntity> answersFoundedEntities = this.answersMapper.findAll();
Assert.assertEquals(3, answersFoundedEntities.size());
Integer index = 0;
for (AnswerEntity answerEntity : answersFoundedEntities) {
final AnswerEntity answerFixtureEntity = this.answersSupport.getEntityFixtureMock(index);
this.answersSupport.assertEquals(answerFixtureEntity, answerEntity);
index++;
}
}
use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final AnswerEntity answerEntity = this.createAnswerEntityMock(id, "NewAnswer", 1, 1, true);
final AnswerModelInterface answerModel = this.mapAnswerModel(answerEntity);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
given(this.answersMapper.find(id)).willReturn(answerEntity);
given(answersOptions.withRelations(answerModel)).willReturn(answerModel);
final AnswerModelInterface foundedAnswerModel = this.answersService.find(id, answersOptions);
verify(answersOptions).withRelations(answerModel);
Assert.assertNotNull(foundedAnswerModel);
Assert.assertEquals(answerModel, foundedAnswerModel);
}
use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersServiceTest method mapAnswerEntity.
private AnswerEntity mapAnswerEntity(AnswerModelInterface answerModel) {
final AnswerEntity answerEntity = new AnswerEntity();
answerEntity.map(answerModel);
return answerEntity;
}
use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final AnswerEntity answerEntity = this.createAnswerEntityMock(id, "NewAnswer", 1, 1, true);
given(this.answersMapper.find(id)).willReturn(answerEntity);
final AnswerModelInterface answerModel = this.answersService.find(id);
Assert.assertEquals(this.mapAnswerModel(answerEntity), answerModel);
}
Aggregations