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;
}
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++;
}
}
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);
}
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());
}
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;
}
Aggregations