Search in sources :

Example 16 with PointEntity

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));
}
Also used : PointEntity(easytests.core.entities.PointEntity) Test(org.junit.Test)

Example 17 with PointEntity

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);
}
Also used : PointEntity(easytests.core.entities.PointEntity) Test(org.junit.Test)

Example 18 with PointEntity

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);
}
Also used : PointEntity(easytests.core.entities.PointEntity) Test(org.junit.Test)

Example 19 with PointEntity

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++;
    }
}
Also used : ArrayList(java.util.ArrayList) PointEntity(easytests.core.entities.PointEntity) Test(org.junit.Test)

Example 20 with PointEntity

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);
}
Also used : PointEntity(easytests.core.entities.PointEntity) DeleteUnidentifiedModelException(easytests.core.services.exceptions.DeleteUnidentifiedModelException)

Aggregations

PointEntity (easytests.core.entities.PointEntity)23 Test (org.junit.Test)13 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 ArrayList (java.util.ArrayList)4 PointModelInterface (easytests.core.models.PointModelInterface)3 PointsOptionsInterface (easytests.core.options.PointsOptionsInterface)3 QuizModelInterface (easytests.core.models.QuizModelInterface)1 QuestionModelEmpty (easytests.core.models.empty.QuestionModelEmpty)1 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)1 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1 Ignore (org.junit.Ignore)1