Search in sources :

Example 36 with AnswerModelInterface

use of easytests.core.models.AnswerModelInterface 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));
}
Also used : ArrayList(java.util.ArrayList) AnswerModelInterface(easytests.core.models.AnswerModelInterface) AnswerEntity(easytests.core.entities.AnswerEntity)

Aggregations

AnswerModelInterface (easytests.core.models.AnswerModelInterface)36 AnswerEntity (easytests.core.entities.AnswerEntity)10 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)9 AnswersServiceInterface (easytests.core.services.AnswersServiceInterface)7 AnswerModel (easytests.core.models.AnswerModel)6 QuestionModelInterface (easytests.core.models.QuestionModelInterface)6 AnswersOptionsInterface (easytests.core.options.AnswersOptionsInterface)6 PointModelInterface (easytests.core.models.PointModelInterface)5 SolutionModelInterface (easytests.core.models.SolutionModelInterface)5 TopicModelInterface (easytests.core.models.TopicModelInterface)4 TopicsServiceInterface (easytests.core.services.TopicsServiceInterface)4 InOrder (org.mockito.InOrder)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 PointsServiceInterface (easytests.core.services.PointsServiceInterface)3 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)2 QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)2 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)2 QuestionTypesServiceInterface (easytests.core.services.QuestionTypesServiceInterface)2 QuestionsServiceInterface (easytests.core.services.QuestionsServiceInterface)2