use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesServiceTest method mapIssueEntity.
private IssueEntity mapIssueEntity(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 IssuesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final IssueEntity issueEntity = Entities.createIssueEntityMock(id, "Name", 2);
final IssueModelInterface issueModel = this.mapIssueModel(issueEntity);
final IssuesOptionsInterface issuesOptions = Mockito.mock(IssuesOptionsInterface.class);
given(this.issuesMapper.find(id)).willReturn(issueEntity);
given(issuesOptions.withRelations(issueModel)).willReturn(issueModel);
final IssueModelInterface foundedIssueModel = this.issuesService.find(id, issuesOptions);
Assert.assertEquals(issueModel, foundedIssueModel);
verify(issuesOptions).withRelations(issueModel);
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesService method delete.
@Override
public void delete(IssueModelInterface issueModel) {
final IssueEntity issueEntity = this.map(issueModel);
if (issueEntity.getId() == null) {
throw new DeleteUnidentifiedModelException();
}
this.issuesMapper.delete(issueEntity);
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesService method save.
@Override
public void save(IssueModelInterface issueModel) {
final IssueEntity issueEntity = this.map(issueModel);
if (issueEntity.getId() == null) {
this.issuesMapper.insert(issueEntity);
issueModel.setId(issueEntity.getId());
return;
}
this.issuesMapper.update(issueEntity);
}
use of easytests.core.entities.IssueEntity in project easy-tests by malinink.
the class IssuesMapperTest method testInsert.
@Test
public void testInsert() throws Exception {
final Integer id = this.issuesMapper.findAll().size() + 1;
final String name = "NewName";
final Integer subjectId = 2;
IssueEntity issueEntity = Mockito.mock(IssueEntity.class);
Mockito.when(issueEntity.getName()).thenReturn(name);
Mockito.when(issueEntity.getSubjectId()).thenReturn(subjectId);
this.issuesMapper.insert(issueEntity);
verify(issueEntity, times(1)).setId(id);
issueEntity = this.issuesMapper.find(id);
Assert.assertEquals(id, issueEntity.getId());
Assert.assertEquals(name, issueEntity.getName());
Assert.assertEquals(subjectId, issueEntity.getSubjectId());
}
Aggregations