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);
}
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;
}
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());
}
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);
}
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());
}
Aggregations