Search in sources :

Example 1 with TesteeEntity

use of easytests.core.entities.TesteeEntity in project easy-tests by malinink.

the class TesteesMapperTest method testFindAll.

@Test
public void testFindAll() throws Exception {
    final List<TesteeEntity> testeesFoundedEntities = this.testeesMapper.findAll();
    Assert.assertEquals(3, testeesFoundedEntities.size());
    Integer index = 0;
    for (TesteeEntity testeeEntity : testeesFoundedEntities) {
        final TesteeEntity testeeFixtureEntity = this.testeesSupport.getEntityFixtureMock(index);
        this.testeesSupport.assertEquals(testeeFixtureEntity, testeeEntity);
        index++;
    }
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) Test(org.junit.Test)

Example 2 with TesteeEntity

use of easytests.core.entities.TesteeEntity in project easy-tests by malinink.

the class TesteesServiceTest method testFindPresentModel.

@Test
public void testFindPresentModel() throws Exception {
    final Integer id = 1;
    final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(id, "NewFirstName", "NewLastName1", "NewSurname1", 307, 7);
    given(this.testeesMapper.find(id)).willReturn(testeeEntity);
    final TesteeModelInterface testeeModel = this.testeesService.find(id);
    Assert.assertEquals(this.mapTesteeModel(testeeEntity), testeeModel);
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with TesteeEntity

use of easytests.core.entities.TesteeEntity in project easy-tests by malinink.

the class TesteesServiceTest method mapTesteeEntity.

private TesteeEntity mapTesteeEntity(TesteeModelInterface testeeModel) {
    final TesteeEntity testeeEntity = new TesteeEntity();
    testeeEntity.map(testeeModel);
    return testeeEntity;
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity)

Example 4 with TesteeEntity

use of easytests.core.entities.TesteeEntity in project easy-tests by malinink.

the class TesteesServiceTest method getTesteesEntities.

private List<TesteeEntity> getTesteesEntities() {
    final List<TesteeEntity> testeesEntities = new ArrayList<>(2);
    final TesteeEntity testeeEntityFirst = Entities.createTesteeEntityMock(1, "FirstName1", "LastName1", "Surname1", 301, 1);
    final TesteeEntity testeeEntitySecond = Entities.createTesteeEntityMock(2, "FirstName2", "LastName2", "Surname2", 302, 2);
    testeesEntities.add(testeeEntityFirst);
    testeesEntities.add(testeeEntitySecond);
    return testeesEntities;
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) ArrayList(java.util.ArrayList)

Example 5 with TesteeEntity

use of easytests.core.entities.TesteeEntity in project easy-tests by malinink.

the class TesteesServiceTest method testSaveCreatesEntity.

@Test
public void testSaveCreatesEntity() throws Exception {
    final TesteeModelInterface testeeModel = Models.createTesteeModel(null, "FirstName", "LastName", "Surname", 301, 1);
    doAnswer(invocation -> {
        final TesteeEntity testeeEntity = (TesteeEntity) invocation.getArguments()[0];
        testeeEntity.setId(5);
        return null;
    }).when(this.testeesMapper).insert(Mockito.any(TesteeEntity.class));
    this.testeesService.save(testeeModel);
    verify(this.testeesMapper, times(1)).insert(this.mapTesteeEntity(testeeModel));
    Assert.assertEquals((Integer) 5, testeeModel.getId());
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TesteeEntity (easytests.core.entities.TesteeEntity)20 Test (org.junit.Test)13 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)12 TesteeModelInterface (easytests.core.models.TesteeModelInterface)6 TesteesOptionsInterface (easytests.core.options.TesteesOptionsInterface)3 QuizModelInterface (easytests.core.models.QuizModelInterface)1 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)1 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1 ArrayList (java.util.ArrayList)1