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