Search in sources :

Example 11 with TesteeEntity

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

the class TesteesMapperTest method testFind.

@Test
public void testFind() throws Exception {
    final TesteeEntity testee = this.testeesMapper.find(1);
    Assert.assertEquals((long) 1, (long) testee.getId());
    Assert.assertEquals("FirstName1", testee.getFirstName());
    Assert.assertEquals("LastName1", testee.getLastName());
    Assert.assertEquals("Surname1", testee.getSurname());
    Assert.assertEquals((long) 1, (long) testee.getQuizId());
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with TesteeEntity

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

the class TesteesMapperTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    final Integer id = 1;
    final String firstName = "NewFirstName";
    final String lastName = "NewLastName";
    final String surname = "NewSurname";
    final Integer groupNumber = 308;
    final Integer quizId = 19;
    TesteeEntity testeeEntity = this.testeesMapper.find(id);
    Assert.assertNotNull(testeeEntity);
    Assert.assertEquals(id, testeeEntity.getId());
    Assert.assertNotEquals(firstName, testeeEntity.getFirstName());
    Assert.assertNotEquals(lastName, testeeEntity.getLastName());
    Assert.assertNotEquals(surname, testeeEntity.getSurname());
    Assert.assertNotEquals(groupNumber, testeeEntity.getGroupNumber());
    Assert.assertNotEquals(quizId, testeeEntity.getQuizId());
    testeeEntity = Mockito.mock(TesteeEntity.class);
    Mockito.when(testeeEntity.getId()).thenReturn(id);
    Mockito.when(testeeEntity.getFirstName()).thenReturn(firstName);
    Mockito.when(testeeEntity.getLastName()).thenReturn(lastName);
    Mockito.when(testeeEntity.getSurname()).thenReturn(surname);
    Mockito.when(testeeEntity.getGroupNumber()).thenReturn(groupNumber);
    Mockito.when(testeeEntity.getQuizId()).thenReturn(quizId);
    this.testeesMapper.update(testeeEntity);
    testeeEntity = this.testeesMapper.find(id);
    Assert.assertEquals(id, testeeEntity.getId());
    Assert.assertEquals(firstName, testeeEntity.getFirstName());
    Assert.assertEquals(lastName, testeeEntity.getLastName());
    Assert.assertEquals(surname, testeeEntity.getSurname());
    Assert.assertEquals(groupNumber, testeeEntity.getGroupNumber());
    Assert.assertEquals(quizId, testeeEntity.getQuizId());
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 13 with TesteeEntity

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

the class TesteesSupport method getEntityMock.

private TesteeEntity getEntityMock(Integer id, String firstName, String lastName, String surName, Integer groupNumber, Integer quizId) {
    TesteeEntity testeeEntity = Mockito.mock(TesteeEntity.class);
    Mockito.when(testeeEntity.getId()).thenReturn(id);
    Mockito.when(testeeEntity.getFirstName()).thenReturn(firstName);
    Mockito.when(testeeEntity.getLastName()).thenReturn(lastName);
    Mockito.when(testeeEntity.getSurname()).thenReturn(surName);
    Mockito.when(testeeEntity.getGroupNumber()).thenReturn(groupNumber);
    Mockito.when(testeeEntity.getQuizId()).thenReturn(quizId);
    return testeeEntity;
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity)

Example 14 with TesteeEntity

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

the class TesteesSupport method assetEntityListEquals.

public void assetEntityListEquals(List<TesteeEntity> expected, List<TesteeEntity> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    Integer i = 0;
    for (TesteeEntity testeeEntity : expected) {
        this.assertEquals(testeeEntity, actual.get(i));
        i++;
    }
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity)

Example 15 with TesteeEntity

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

the class TesteesService method delete.

@Override
public void delete(TesteeModelInterface testeeModel) {
    final TesteeEntity testeeEntity = this.map(testeeModel);
    if (testeeEntity.getId() == null) {
        throw new DeleteUnidentifiedModelException();
    }
    this.testeesMapper.delete(testeeEntity);
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) DeleteUnidentifiedModelException(easytests.core.services.exceptions.DeleteUnidentifiedModelException)

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