use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersService method map.
private AnswerEntity map(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 createAnswerEntityMock.
private AnswerEntity createAnswerEntityMock(Integer id, String txt, Integer questionId, Integer serialNumber, boolean right) {
final AnswerEntity answerEntity = Mockito.mock(AnswerEntity.class);
Mockito.when(answerEntity.getId()).thenReturn(id);
Mockito.when(answerEntity.getTxt()).thenReturn(txt);
Mockito.when(answerEntity.getQuestionId()).thenReturn(questionId);
Mockito.when(answerEntity.getSerialNumber()).thenReturn(serialNumber);
Mockito.when(answerEntity.getRight()).thenReturn(right);
return answerEntity;
}
use of easytests.core.entities.AnswerEntity in project easy-tests by malinink.
the class AnswersServiceTest method testFindAllPresentList.
@Test
public void testFindAllPresentList() throws Exception {
final List<AnswerEntity> answersEntities = new ArrayList<>(2);
final AnswerEntity answerEntityFirst = this.createAnswerEntityMock(1, "Answer1", 1, 1, true);
final AnswerEntity answerEntitySecond = this.createAnswerEntityMock(2, "Answer2", 2, 2, false);
answersEntities.add(answerEntityFirst);
answersEntities.add(answerEntitySecond);
given(this.answersMapper.findAll()).willReturn(answersEntities);
final List<AnswerModelInterface> answersModels = this.answersService.findAll();
Assert.assertEquals(2, answersModels.size());
Assert.assertEquals(answersModels.get(0), this.mapAnswerModel(answerEntityFirst));
Assert.assertEquals(answersModels.get(1), this.mapAnswerModel(answerEntitySecond));
}
Aggregations