use of easytests.core.entities.TopicEntity in project easy-tests by malinink.
the class TopicsMapperTest method testFindBySubjectId.
@Test
public void testFindBySubjectId() throws Exception {
final List<TopicEntity> topicsFixtureEntities = new ArrayList<>();
topicsFixtureEntities.add(this.topicsSupport.getEntityFixtureMock(0));
topicsFixtureEntities.add(this.topicsSupport.getEntityFixtureMock(1));
final List<TopicEntity> topicsFoundedEntities = this.topicsMapper.findBySubjectId(2);
Assert.assertEquals(topicsFixtureEntities.size(), topicsFoundedEntities.size());
Integer index = 0;
for (TopicEntity topicEntity : topicsFoundedEntities) {
this.topicsSupport.assertEquals(topicsFixtureEntities.get(index), topicEntity);
index++;
}
}
use of easytests.core.entities.TopicEntity in project easy-tests by malinink.
the class TopicsMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<TopicEntity> topicsFoundedEntities = this.topicsMapper.findAll();
Assert.assertEquals(3, topicsFoundedEntities.size());
Integer index = 0;
for (TopicEntity topicEntity : topicsFoundedEntities) {
this.topicsSupport.assertEquals(this.topicsSupport.getEntityFixtureMock(index), topicEntity);
index++;
}
}
use of easytests.core.entities.TopicEntity in project easy-tests by malinink.
the class TopicsMapperTest method testInsert.
@Test
public void testInsert() throws Exception {
final Integer id = this.topicsMapper.findAll().size() + 1;
final String name = "FirstName";
final Integer subjectId = 3;
TopicEntity topicEntity = Mockito.mock(TopicEntity.class);
Mockito.when(topicEntity.getName()).thenReturn(name);
Mockito.when(topicEntity.getSubjectId()).thenReturn(subjectId);
this.topicsMapper.insert(topicEntity);
verify(topicEntity, times(1)).setId(id);
topicEntity = this.topicsMapper.find(id);
Assert.assertEquals(id, topicEntity.getId());
Assert.assertEquals(name, topicEntity.getName());
Assert.assertEquals(subjectId, topicEntity.getSubjectId());
}
use of easytests.core.entities.TopicEntity in project easy-tests by malinink.
the class TopicsMapperTest method testFind.
@Test
public void testFind() throws Exception {
final TopicEntity topicEntity = this.topicsMapper.find(1);
Assert.assertEquals((Integer) 1, topicEntity.getId());
Assert.assertEquals("Name1", topicEntity.getName());
Assert.assertEquals((Integer) 2, topicEntity.getSubjectId());
}
use of easytests.core.entities.TopicEntity in project easy-tests by malinink.
the class TopicsService method delete.
@Override
public void delete(TopicModelInterface topicModel) {
final TopicEntity topicEntity = this.map(topicModel);
if (topicEntity.getId() == null) {
throw new DeleteUnidentifiedModelException();
}
this.topicsMapper.delete(topicEntity);
}
Aggregations