use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesMapperTest method testDelete.
@Test
public void testDelete() throws Exception {
IssueEntity issue = this.issuesMapper.find(1);
Assert.assertNotNull(issue);
this.issuesMapper.delete(issue);
issue = this.issuesMapper.find(1);
Assert.assertNull(issue);
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesService method map.
private IssueEntity map(IssueModelInterface issueModel) {
final IssueEntity issueEntity = new IssueEntity();
issueEntity.map(issueModel);
return issueEntity;
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesMapperTest method testFind.
@Test
public void testFind() throws Exception {
final IssueEntity issue = this.issuesMapper.find(1);
Assert.assertEquals((long) 1, (long) issue.getId());
Assert.assertEquals("Name1", issue.getName());
Assert.assertEquals((long) 1, (long) issue.getSubjectId());
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesMapperTest method testUpdate.
@Test
public void testUpdate() throws Exception {
final Integer id = 1;
final String name = "NewName";
final Integer subjectId = 2;
IssueEntity issueEntity = this.issuesMapper.find(id);
Assert.assertNotNull(issueEntity);
Assert.assertEquals(id, issueEntity.getId());
Assert.assertNotEquals(name, issueEntity.getName());
Assert.assertNotEquals(subjectId, issueEntity.getSubjectId());
issueEntity = Mockito.mock(IssueEntity.class);
Mockito.when(issueEntity.getId()).thenReturn(id);
Mockito.when(issueEntity.getName()).thenReturn(name);
Mockito.when(issueEntity.getSubjectId()).thenReturn(subjectId);
this.issuesMapper.update(issueEntity);
issueEntity = this.issuesMapper.find(id);
Assert.assertEquals(id, issueEntity.getId());
Assert.assertEquals(name, issueEntity.getName());
Assert.assertEquals(subjectId, issueEntity.getSubjectId());
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesServiceTest method testFindBySubjectWithOptions.
@Test
public void testFindBySubjectWithOptions() throws Exception {
final Integer subjectId = 7;
final SubjectModelInterface subjectModel = Mockito.mock(SubjectModelInterface.class);
final IssueEntity issueEntityFirst = Entities.createIssueEntityMock(4, "test3", subjectId);
final IssueEntity issueEntitySecond = Entities.createIssueEntityMock(12, "test12", subjectId);
final List<IssueEntity> issuesEntities = new ArrayList<>();
issuesEntities.add(issueEntityFirst);
issuesEntities.add(issueEntitySecond);
Mockito.when(subjectModel.getId()).thenReturn(subjectId);
given(this.issuesMapper.findBySubjectId(subjectId)).willReturn(issuesEntities);
final List<IssueModelInterface> issuesModels = new ArrayList<>();
issuesModels.add(this.mapIssueModel(issueEntityFirst));
issuesModels.add(this.mapIssueModel(issueEntitySecond));
final IssuesOptionsInterface issuesOptions = Mockito.mock(IssuesOptionsInterface.class);
given(issuesOptions.withRelations(issuesModels)).willReturn(issuesModels);
final List<IssueModelInterface> foundIssuesModels = this.issuesService.findBySubject(subjectModel, issuesOptions);
verify(this.issuesMapper).findBySubjectId(subjectId);
verify(issuesOptions).withRelations(issuesModels);
Assert.assertEquals(issuesModels, foundIssuesModels);
}
Aggregations