Search in sources :

Example 6 with QuestionTypeModelEmpty

use of easytests.core.models.empty.QuestionTypeModelEmpty in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionsSupport method assertEquals.

public void assertEquals(IssueStandardQuestionTypeOptionEntity expected, IssueStandardQuestionTypeOptionModelInterface actual) {
    assertEquals(actual, expected);
    Assert.assertEquals(new QuestionTypeModelEmpty(expected.getQuestionTypeId()), actual.getQuestionType());
    Assert.assertEquals(new IssueStandardModelEmpty(expected.getIssueStandardId()), actual.getIssueStandard());
}
Also used : IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty)

Example 7 with QuestionTypeModelEmpty

use of easytests.core.models.empty.QuestionTypeModelEmpty in project easy-tests by malinink.

the class QuestionsSupport method getModelMock.

private QuestionModelInterface getModelMock(Integer id, String text, Integer questionTypeId, Integer topicId) {
    final QuestionModelInterface questionModel = Mockito.mock(QuestionModelInterface.class);
    Mockito.when(questionModel.getId()).thenReturn(id);
    Mockito.when(questionModel.getText()).thenReturn(text);
    Mockito.when(questionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionTypeId));
    Mockito.when(questionModel.getTopic()).thenReturn(new TopicModelEmpty(topicId));
    Mockito.when(questionModel.getAnswers()).thenReturn(new ModelsListEmpty());
    return questionModel;
}
Also used : TopicModelEmpty(easytests.core.models.empty.TopicModelEmpty) QuestionModelInterface(easytests.core.models.QuestionModelInterface) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty)

Example 8 with QuestionTypeModelEmpty

use of easytests.core.models.empty.QuestionTypeModelEmpty in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionEntityTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer id = 3;
    final Integer questionTypeId = 4;
    final Integer minQuestions = 10;
    final Integer maxQuestions = 20;
    final Integer timeLimit = 600;
    final Integer issueStandardId = 12;
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = Mockito.mock(IssueStandardQuestionTypeOptionModelInterface.class);
    Mockito.when(questionTypeOptionModel.getId()).thenReturn(id);
    Mockito.when(questionTypeOptionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionTypeId));
    Mockito.when(questionTypeOptionModel.getMinQuestions()).thenReturn(minQuestions);
    Mockito.when(questionTypeOptionModel.getMaxQuestions()).thenReturn(maxQuestions);
    Mockito.when(questionTypeOptionModel.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(questionTypeOptionModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty(issueStandardId));
    final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = new IssueStandardQuestionTypeOptionEntity();
    questionTypeOptionEntity.map(questionTypeOptionModel);
    Assert.assertEquals(id, questionTypeOptionEntity.getId());
    Assert.assertEquals(questionTypeId, questionTypeOptionEntity.getQuestionTypeId());
    Assert.assertEquals(minQuestions, questionTypeOptionEntity.getMinQuestions());
    Assert.assertEquals(maxQuestions, questionTypeOptionEntity.getMaxQuestions());
    Assert.assertEquals(timeLimit, questionTypeOptionEntity.getTimeLimit());
    Assert.assertEquals(issueStandardId, questionTypeOptionEntity.getIssueStandardId());
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty) Test(org.junit.Test)

Example 9 with QuestionTypeModelEmpty

use of easytests.core.models.empty.QuestionTypeModelEmpty in project easy-tests by malinink.

the class QuestionsServiceTest method testSaveModel.

@Test
public void testSaveModel() throws Exception {
    final QuestionModelInterface questionModel = new QuestionModel();
    questionModel.setText("test1");
    questionModel.setQuestionType(new QuestionTypeModelEmpty(1));
    questionModel.setAnswers(new ModelsListEmpty());
    questionModel.setTopic(new TopicModelEmpty(1));
    this.questionsService.save(questionModel);
    final QuestionModelInterface foundedQuestionModel = this.questionsService.find(questionModel.getId());
    Assert.assertEquals(questionModel, foundedQuestionModel);
}
Also used : TopicModelEmpty(easytests.core.models.empty.TopicModelEmpty) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with QuestionTypeModelEmpty

use of easytests.core.models.empty.QuestionTypeModelEmpty in project easy-tests by malinink.

the class IssueStandardQuestionTypeOptionModel method map.

public void map(IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity) {
    this.setId(questionTypeOptionEntity.getId());
    this.setQuestionType(new QuestionTypeModelEmpty(questionTypeOptionEntity.getQuestionTypeId()));
    this.setMinQuestions(questionTypeOptionEntity.getMinQuestions());
    this.setMaxQuestions(questionTypeOptionEntity.getMaxQuestions());
    this.setTimeLimit(questionTypeOptionEntity.getTimeLimit());
    this.setIssueStandard(new IssueStandardModelEmpty(questionTypeOptionEntity.getIssueStandardId()));
}
Also used : IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty)

Aggregations

QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)14 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)7 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)7 Test (org.junit.Test)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)5 IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)4 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)4 QuestionTypesServiceInterface (easytests.core.services.QuestionTypesServiceInterface)4 QuestionModelInterface (easytests.core.models.QuestionModelInterface)3 ArrayList (java.util.ArrayList)3 AnswerModelInterface (easytests.core.models.AnswerModelInterface)2 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)2 TopicModelInterface (easytests.core.models.TopicModelInterface)2 AnswersServiceInterface (easytests.core.services.AnswersServiceInterface)2 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)2 TopicsServiceInterface (easytests.core.services.TopicsServiceInterface)2 QuestionEntity (easytests.core.entities.QuestionEntity)1