use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsMapperTest method testDelete.
@Test
public void testDelete() throws Exception {
final Integer id = this.pointsSupport.getEntityFixtureMock(0).getId();
final PointEntity pointFoundedEntity = this.pointsMapper.find(id);
Assert.assertNotNull(pointFoundedEntity);
this.pointsMapper.delete(pointFoundedEntity);
Assert.assertNull(this.pointsMapper.find(id));
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsMapperTest method testInsert.
@Test
public void testInsert() throws Exception {
final ArgumentCaptor<Integer> id = ArgumentCaptor.forClass(Integer.class);
final PointEntity pointUnidentifiedEntity = this.pointsSupport.getEntityAdditionalMock(0);
this.pointsMapper.insert(pointUnidentifiedEntity);
verify(pointUnidentifiedEntity, times(1)).setId(id.capture());
Assert.assertNotNull(id.getValue());
final PointEntity pointInsertedEntity = this.pointsMapper.find(id.getValue());
Assert.assertNotNull(pointInsertedEntity);
this.pointsSupport.assertEqualsWithoutId(pointUnidentifiedEntity, pointInsertedEntity);
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsMapperTest method testFind.
@Test
public void testFind() throws Exception {
final PointEntity pointFixtureEntity = this.pointsSupport.getEntityFixtureMock(0);
final PointEntity pointFoundedEntity = this.pointsMapper.find(1);
this.pointsSupport.assertEquals(pointFixtureEntity, pointFoundedEntity);
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsMapperTest method testFindByQuizId.
@Test
public void testFindByQuizId() throws Exception {
final List<PointEntity> pointsFixtureEntities = new ArrayList<>();
pointsFixtureEntities.add(this.pointsSupport.getEntityFixtureMock(1));
pointsFixtureEntities.add(this.pointsSupport.getEntityFixtureMock(2));
final List<PointEntity> pointsFoundedEntities = this.pointsMapper.findByQuizId(2);
Assert.assertEquals(2, pointsFoundedEntities.size());
Integer index = 0;
for (PointEntity pointEntity : pointsFoundedEntities) {
this.pointsSupport.assertEquals(pointsFixtureEntities.get(index), pointEntity);
index++;
}
}
use of easytests.core.entities.PointEntity in project easy-tests by malinink.
the class PointsService method delete.
@Override
public void delete(PointModelInterface pointModel) {
final PointEntity pointEntity = this.map(pointModel);
if (pointEntity.getId() == null) {
throw new DeleteUnidentifiedModelException();
}
this.pointsMapper.delete(pointEntity);
}
Aggregations