Search in sources :

Example 6 with IssueStandardEntity

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

the class IssueStandardsMapperTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    final Integer id = 1;
    final Integer timeLimit = 3600;
    final Integer questionsNumber = 20;
    final Integer subjectId = 2;
    IssueStandardEntity issueStandardEntity = this.issueStandardsMapper.find(id);
    Assert.assertNotNull(issueStandardEntity);
    Assert.assertEquals(id, issueStandardEntity.getId());
    Assert.assertNotEquals(timeLimit, issueStandardEntity.getTimeLimit());
    Assert.assertNotEquals(questionsNumber, issueStandardEntity.getQuestionsNumber());
    Assert.assertNotEquals(subjectId, issueStandardEntity.getSubjectId());
    issueStandardEntity = Mockito.mock(IssueStandardEntity.class);
    Mockito.when(issueStandardEntity.getId()).thenReturn(id);
    Mockito.when(issueStandardEntity.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(issueStandardEntity.getQuestionsNumber()).thenReturn(questionsNumber);
    Mockito.when(issueStandardEntity.getSubjectId()).thenReturn(subjectId);
    this.issueStandardsMapper.update(issueStandardEntity);
    issueStandardEntity = this.issueStandardsMapper.find(id);
    Assert.assertEquals(id, issueStandardEntity.getId());
    Assert.assertEquals(timeLimit, issueStandardEntity.getTimeLimit());
    Assert.assertEquals(questionsNumber, issueStandardEntity.getQuestionsNumber());
    Assert.assertEquals(subjectId, issueStandardEntity.getSubjectId());
}
Also used : IssueStandardEntity(easytests.core.entities.IssueStandardEntity) Test(org.junit.Test)

Example 7 with IssueStandardEntity

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

the class IssueStandardsMapperTest method deleteTest.

@Test
public void deleteTest() throws Exception {
    IssueStandardEntity issueStandardEntity = this.issueStandardsMapper.find(1);
    Assert.assertNotNull(issueStandardEntity);
    this.issueStandardsMapper.delete(issueStandardEntity);
    issueStandardEntity = this.issueStandardsMapper.find(1);
    Assert.assertNull(issueStandardEntity);
}
Also used : IssueStandardEntity(easytests.core.entities.IssueStandardEntity) Test(org.junit.Test)

Example 8 with IssueStandardEntity

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

the class IssueStandardModelTest method testMap.

@Test
public void testMap() {
    final Integer id = 5;
    final Integer timeLimit = 3600;
    final Integer questionsNumber = 30;
    final Integer subjectId = 3;
    final IssueStandardEntity issueStandardEntity = Mockito.mock(IssueStandardEntity.class);
    Mockito.when(issueStandardEntity.getId()).thenReturn(id);
    Mockito.when(issueStandardEntity.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(issueStandardEntity.getQuestionsNumber()).thenReturn(questionsNumber);
    Mockito.when(issueStandardEntity.getSubjectId()).thenReturn(subjectId);
    final IssueStandardModelInterface issueStandardModel = new IssueStandardModel();
    issueStandardModel.map(issueStandardEntity);
    Assert.assertEquals(id, issueStandardModel.getId());
    Assert.assertEquals(timeLimit, issueStandardModel.getTimeLimit());
    Assert.assertEquals(questionsNumber, issueStandardModel.getQuestionsNumber());
    Assert.assertEquals(new ModelsListEmpty(), issueStandardModel.getTopicPriorities());
    Assert.assertEquals(new ModelsListEmpty(), issueStandardModel.getQuestionTypeOptions());
    Assert.assertEquals(new SubjectModelEmpty(subjectId), issueStandardModel.getSubject());
}
Also used : SubjectModelEmpty(easytests.core.models.empty.SubjectModelEmpty) IssueStandardEntity(easytests.core.entities.IssueStandardEntity) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) Test(org.junit.Test)

Aggregations

IssueStandardEntity (easytests.core.entities.IssueStandardEntity)8 Test (org.junit.Test)7 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)1 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)1