Search in sources :

Example 1 with QuestionEntity

use of easytests.core.entities.QuestionEntity in project easy-tests by malinink.

the class QuestionsSupport method getEntityMock.

private QuestionEntity getEntityMock(Integer id, String text, Integer questionTypeId, Integer topicId) {
    final QuestionEntity questionEntity = Mockito.mock(QuestionEntity.class);
    Mockito.when(questionEntity.getId()).thenReturn(id);
    Mockito.when(questionEntity.getText()).thenReturn(text);
    Mockito.when(questionEntity.getQuestionTypeId()).thenReturn(questionTypeId);
    Mockito.when(questionEntity.getTopicId()).thenReturn(topicId);
    return questionEntity;
}
Also used : QuestionEntity(easytests.core.entities.QuestionEntity)

Example 2 with QuestionEntity

use of easytests.core.entities.QuestionEntity in project easy-tests by malinink.

the class QuestionsSupport method assertEntitiesListEquals.

public void assertEntitiesListEquals(List<QuestionEntity> expected, List<QuestionEntity> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    Integer i = 0;
    for (QuestionEntity questionEntity : expected) {
        this.assertEquals(questionEntity, actual.get(i));
        i++;
    }
}
Also used : QuestionEntity(easytests.core.entities.QuestionEntity)

Example 3 with QuestionEntity

use of easytests.core.entities.QuestionEntity in project easy-tests by malinink.

the class QuestionsMapperTest method testDelete.

@Test
public void testDelete() throws Exception {
    QuestionEntity questionEntity = this.questionsMapper.find(1);
    Assert.assertNotNull(questionEntity);
    this.questionsMapper.delete(questionEntity);
    questionEntity = this.questionsMapper.find(1);
    Assert.assertNull(questionEntity);
}
Also used : QuestionEntity(easytests.core.entities.QuestionEntity) Test(org.junit.Test)

Example 4 with QuestionEntity

use of easytests.core.entities.QuestionEntity in project easy-tests by malinink.

the class QuestionsMapperTest method testInsert.

@Test
public void testInsert() throws Exception {
    final Integer id = this.questionsMapper.findAll().size() + 1;
    final String text = "text1";
    final Integer questionTypeId = 1;
    final Integer topicId = 1;
    QuestionEntity questionEntity = Mockito.mock(QuestionEntity.class);
    Mockito.when(questionEntity.getText()).thenReturn(text);
    Mockito.when(questionEntity.getQuestionTypeId()).thenReturn(questionTypeId);
    Mockito.when(questionEntity.getTopicId()).thenReturn(topicId);
    this.questionsMapper.insert(questionEntity);
    verify(questionEntity, times(1)).setId(id);
    questionEntity = this.questionsMapper.find(id);
    Assert.assertEquals(id, questionEntity.getId());
    Assert.assertEquals(text, questionEntity.getText());
    Assert.assertEquals(questionTypeId, questionEntity.getQuestionTypeId());
    Assert.assertEquals(topicId, questionEntity.getTopicId());
}
Also used : QuestionEntity(easytests.core.entities.QuestionEntity) Test(org.junit.Test)

Example 5 with QuestionEntity

use of easytests.core.entities.QuestionEntity in project easy-tests by malinink.

the class QuestionsService method map.

private QuestionEntity map(QuestionModelInterface questionModel) {
    final QuestionEntity questionEntity = new QuestionEntity();
    questionEntity.map(questionModel);
    return questionEntity;
}
Also used : QuestionEntity(easytests.core.entities.QuestionEntity)

Aggregations

QuestionEntity (easytests.core.entities.QuestionEntity)22 QuestionModelInterface (easytests.core.models.QuestionModelInterface)8 Test (org.junit.Test)7 TopicModelInterface (easytests.core.models.TopicModelInterface)3 QuestionsOptionsInterface (easytests.core.options.QuestionsOptionsInterface)3 ArrayList (java.util.ArrayList)3 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)1 QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)1 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)1 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1