use of easytests.core.models.IssueStandardModelInterface in project easy-tests by malinink.
the class IssueStandardEntityTest method testMap.
@Test
public void testMap() {
final Integer id = 5;
final Integer timeLimit = 3600;
final Integer questionsNumber = 30;
final Integer subjectId = 3;
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(id);
Mockito.when(issueStandardModel.getTimeLimit()).thenReturn(timeLimit);
Mockito.when(issueStandardModel.getQuestionsNumber()).thenReturn(questionsNumber);
Mockito.when(issueStandardModel.getTopicPriorities()).thenReturn(new ModelsListEmpty());
Mockito.when(issueStandardModel.getQuestionTypeOptions()).thenReturn(new ModelsListEmpty());
Mockito.when(issueStandardModel.getSubject()).thenReturn(new SubjectModelEmpty(subjectId));
final IssueStandardEntity issueStandardEntity = new IssueStandardEntity();
issueStandardEntity.map(issueStandardModel);
Assert.assertEquals(id, issueStandardEntity.getId());
Assert.assertEquals(timeLimit, issueStandardEntity.getTimeLimit());
Assert.assertEquals(questionsNumber, issueStandardEntity.getQuestionsNumber());
Assert.assertEquals(subjectId, issueStandardEntity.getSubjectId());
}
use of easytests.core.models.IssueStandardModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final Integer issueStandardId = 1;
final IssueStandardTopicPriorityModelInterface topicPriorityModel = Models.createTopicPriorityModel(id, 1, true, issueStandardId);
final IssueStandardModelInterface issueStandardModel = Models.createIssueStandardModel(issueStandardId, 300, 30, 1);
topicPriorityModel.setIssueStandard(issueStandardModel);
final IssueStandardTopicPriorityModelInterface foundedTopicPriorityModel = this.topicPrioritiesService.find(id, new IssueStandardTopicPrioritiesOptions().withIssueStandard(new IssueStandardsOptions()));
Assert.assertEquals(topicPriorityModel, foundedTopicPriorityModel);
Assert.assertEquals(issueStandardModel, foundedTopicPriorityModel.getIssueStandard());
}
use of easytests.core.models.IssueStandardModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesServiceTest method testFindByIssueStandardPresentList.
@Test
public void testFindByIssueStandardPresentList() throws Exception {
final Integer issueStandardId = 5;
final List<IssueStandardTopicPriorityEntity> topicPriorityEntities = new ArrayList<>(2);
topicPriorityEntities.add(Entities.createTopicPriorityEntityMock(1, 2, true, issueStandardId));
topicPriorityEntities.add(Entities.createTopicPriorityEntityMock(2, 4, false, issueStandardId));
given(this.topicPrioritiesMapper.findByIssueStandardId(issueStandardId)).willReturn(topicPriorityEntities);
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
final List<IssueStandardTopicPriorityModelInterface> topicPriorityModels = this.topicPrioritiesService.findByIssueStandard(issueStandardModel);
Assert.assertNotNull(topicPriorityModels);
Assert.assertEquals(topicPriorityEntities.size(), topicPriorityModels.size());
for (int i = 0; i < topicPriorityModels.size(); i++) {
Assert.assertEquals(topicPriorityModels.get(i), this.mapTopicPriorityModel(topicPriorityEntities.get(i)));
}
}
use of easytests.core.models.IssueStandardModelInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesServiceTest method testFindByIssueStandardAbsentList.
@Test
public void testFindByIssueStandardAbsentList() throws Exception {
final Integer issueStandardId = 10;
given(this.topicPrioritiesMapper.findByIssueStandardId(issueStandardId)).willReturn(new ArrayList<>(0));
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
final List<IssueStandardTopicPriorityModelInterface> topicPriorityModels = this.topicPrioritiesService.findByIssueStandard(issueStandardModel);
Assert.assertNotNull(topicPriorityModels);
Assert.assertEquals(0, topicPriorityModels.size());
}
use of easytests.core.models.IssueStandardModelInterface in project easy-tests by malinink.
the class IssueStandardsServiceTest method testSaveInsertsModel.
@Test
public void testSaveInsertsModel() throws Exception {
final Integer id = this.issueStandardsService.findAll().size() + 1;
final IssueStandardModelInterface issueStandardModel = Models.createIssueStandardModel(null, 200, 20, 2);
this.issueStandardsService.save(issueStandardModel);
IssueStandardModelInterface foundedIssueStandardModel = this.issueStandardsService.find(id);
Assert.assertEquals(issueStandardModel, foundedIssueStandardModel);
}
Aggregations