Search in sources :

Example 16 with IssueStandardModelInterface

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());
}
Also used : SubjectModelEmpty(easytests.core.models.empty.SubjectModelEmpty) IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) Test(org.junit.Test)

Example 17 with IssueStandardModelInterface

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());
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPrioritiesOptions(easytests.core.options.IssueStandardTopicPrioritiesOptions) IssueStandardsOptions(easytests.core.options.IssueStandardsOptions) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 18 with IssueStandardModelInterface

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)));
    }
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) IssueStandardTopicPriorityEntity(easytests.core.entities.IssueStandardTopicPriorityEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 19 with IssueStandardModelInterface

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());
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 20 with IssueStandardModelInterface

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);
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)30 Test (org.junit.Test)25 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)24 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)10 IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)9 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)9 SubjectModelInterface (easytests.core.models.SubjectModelInterface)7 IssueStandardQuestionTypeOptionsServiceInterface (easytests.core.services.IssueStandardQuestionTypeOptionsServiceInterface)7 IssueStandardTopicPrioritiesServiceInterface (easytests.core.services.IssueStandardTopicPrioritiesServiceInterface)7 ArrayList (java.util.ArrayList)6 InOrder (org.mockito.InOrder)6 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)5 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)5 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)4 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)4 IssueStandardsOptions (easytests.core.options.IssueStandardsOptions)3 IssueStandardModel (easytests.core.models.IssueStandardModel)2 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)2 SubjectModel (easytests.core.models.SubjectModel)2 TopicModelInterface (easytests.core.models.TopicModelInterface)2