Search in sources :

Example 6 with SubjectEntity

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

the class SubjectsServiceTest method testFindPresentModel.

@Test
public void testFindPresentModel() throws Exception {
    final Integer id = 1;
    final SubjectEntity subjectEntity = this.createSubjectEntityMock(id, "test", "description", 1);
    given(this.subjectsMapper.find(id)).willReturn(subjectEntity);
    final SubjectModelInterface subjectModel = this.subjectsService.find(id);
    Assert.assertEquals(this.mapSubjectModel(subjectEntity), subjectModel);
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity) SubjectModelInterface(easytests.core.models.SubjectModelInterface)

Example 7 with SubjectEntity

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

the class SubjectsServiceTest method createSubjectEntityMock.

private SubjectEntity createSubjectEntityMock(Integer id, String name, String description, Integer userId) {
    final SubjectEntity subjectEntity = Mockito.mock(SubjectEntity.class);
    Mockito.when(subjectEntity.getId()).thenReturn(id);
    Mockito.when(subjectEntity.getName()).thenReturn(name);
    Mockito.when(subjectEntity.getDescription()).thenReturn(description);
    Mockito.when(subjectEntity.getUserId()).thenReturn(userId);
    return subjectEntity;
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity)

Example 8 with SubjectEntity

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

the class SubjectsServiceTest method getSubjectsEntities.

private List<SubjectEntity> getSubjectsEntities() {
    final List<SubjectEntity> subjectsEntities = new ArrayList<>(2);
    final SubjectEntity subjectEntityFirst = this.createSubjectEntityMock(1, "test1", "description1", 1);
    final SubjectEntity subjectEntitySecond = this.createSubjectEntityMock(2, "test2", "description2", 2);
    subjectsEntities.add(subjectEntityFirst);
    subjectsEntities.add(subjectEntitySecond);
    return subjectsEntities;
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity) ArrayList(java.util.ArrayList)

Example 9 with SubjectEntity

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

the class SubjectsServiceTest method mapSubjectEntity.

private SubjectEntity mapSubjectEntity(SubjectModelInterface subjectModel) {
    final SubjectEntity subjectEntity = new SubjectEntity();
    subjectEntity.map(subjectModel);
    return subjectEntity;
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity)

Example 10 with SubjectEntity

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

the class SubjectModelTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer subjectId = 5;
    final String subjectName = "Test subject";
    final String subjectDescription = "Test subject description";
    final Integer subjectUserId = 3;
    final SubjectEntity subjectEntity = Mockito.mock(SubjectEntity.class);
    Mockito.when(subjectEntity.getId()).thenReturn(subjectId);
    Mockito.when(subjectEntity.getName()).thenReturn(subjectName);
    Mockito.when(subjectEntity.getDescription()).thenReturn(subjectDescription);
    Mockito.when(subjectEntity.getUserId()).thenReturn(subjectUserId);
    final SubjectModelInterface subjectModel = new SubjectModel();
    subjectModel.map(subjectEntity);
    Assert.assertEquals(subjectId, subjectModel.getId());
    Assert.assertEquals(subjectName, subjectModel.getName());
    Assert.assertEquals(subjectDescription, subjectModel.getDescription());
    Assert.assertEquals(new ModelsListEmpty(), subjectModel.getTopics());
    Assert.assertEquals(new UserModelEmpty(subjectUserId), subjectModel.getUser());
    Assert.assertEquals(new IssueStandardModelEmpty(), subjectModel.getIssueStandard());
    Assert.assertEquals(new ModelsListEmpty(), subjectModel.getIssues());
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) Test(org.junit.Test)

Aggregations

SubjectEntity (easytests.core.entities.SubjectEntity)19 SubjectModelInterface (easytests.core.models.SubjectModelInterface)7 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 UserModelInterface (easytests.core.models.UserModelInterface)3 SubjectsOptionsInterface (easytests.core.options.SubjectsOptionsInterface)3 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)1 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)1 UserModelEmpty (easytests.core.models.empty.UserModelEmpty)1