Search in sources :

Example 6 with TesteeEntity

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

the class TesteesServiceTest method testFindByQuizPresentModel.

@Test
public void testFindByQuizPresentModel() throws Exception {
    final Integer quizId = 3;
    final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(3, "FirstName", "LastName", "Surname", 301, quizId);
    given(this.testeesMapper.findByQuizId(quizId)).willReturn(testeeEntity);
    final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
    Mockito.when(quizModel.getId()).thenReturn(quizId);
    final TesteeModelInterface testeeModel = this.testeesService.findByQuiz(quizModel);
    Assert.assertNotNull(testeeModel);
    Assert.assertEquals(this.mapTesteeModel(testeeEntity), testeeModel);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with TesteeEntity

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

the class TesteesService method map.

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

Example 8 with TesteeEntity

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

the class TesteesMapperTest method testInsert.

@Test
public void testInsert() throws Exception {
    final Integer id = this.testeesMapper.findAll().size() + 1;
    final String firstName = "FirstName";
    final String lastName = "LastName";
    final String surname = "Surname";
    final Integer groupNumber = 307;
    final Integer quizId = 19;
    TesteeEntity testeeEntity = Mockito.mock(TesteeEntity.class);
    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.insert(testeeEntity);
    verify(testeeEntity, times(1)).setId(id);
    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 9 with TesteeEntity

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

the class TesteesMapperTest method testDelete.

@Test
public void testDelete() throws Exception {
    TesteeEntity testeeEntity = this.testeesMapper.find(1);
    Assert.assertNotNull(testeeEntity);
    this.testeesMapper.delete(testeeEntity);
    testeeEntity = this.testeesMapper.find(1);
    Assert.assertNull(testeeEntity);
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with TesteeEntity

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

the class TesteesMapperTest method testFindByQuizId.

@Test
public void testFindByQuizId() throws Exception {
    final TesteeEntity testee = this.testeesMapper.findByQuizId(3);
    Assert.assertEquals((long) 3, (long) testee.getId());
    Assert.assertEquals("FirstName3", testee.getFirstName());
    Assert.assertEquals("LastName3", testee.getLastName());
    Assert.assertEquals("Surname3", testee.getSurname());
    Assert.assertEquals((long) 3, (long) testee.getQuizId());
}
Also used : TesteeEntity(easytests.core.entities.TesteeEntity) 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