use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindByQuizWithOptions.
@Test
public void testFindByQuizWithOptions() throws Exception {
final Integer quizId = 3;
final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(3, "FirstName", "LastName", "Surname", 301, quizId);
final TesteeModelInterface testeeModel = this.mapTesteeModel(testeeEntity);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
given(this.testeesMapper.findByQuizId(quizId)).willReturn(testeeEntity);
given(testeesOptions.withRelations(testeeModel)).willReturn(testeeModel);
final TesteeModelInterface foundedTesteeModel = this.testeesService.findByQuiz(testeeModel.getQuiz(), testeesOptions);
verify(testeesOptions).withRelations(testeeModel);
Assert.assertNotNull(foundedTesteeModel);
Assert.assertEquals(testeeModel, foundedTesteeModel);
}
use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final Integer quizId = 1;
final TesteeModelInterface testeeModel = Models.createTesteeModel(id, "FirstName1", "LastName1", "Surname1", 301, quizId);
final QuizModelInterface quizModel = Models.createQuizModel(quizId, "test_invite_code1", 1, LocalDateTime.of(2003, 2, 1, 0, 0, 0), LocalDateTime.of(2003, 3, 1, 0, 0, 0), false);
testeeModel.setQuiz(quizModel);
final TesteeModelInterface foundedTesteeModel = this.testeesService.find(id, new TesteesOptions().withQuiz(new QuizzesOptions()));
Assert.assertEquals(testeeModel, foundedTesteeModel);
Assert.assertEquals(quizModel, foundedTesteeModel.getQuiz());
}
use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final TesteeModelInterface testeeModel = Models.createTesteeModel(id, "FirstName1", "LastName1", "Surname1", 301, 1);
final TesteeModelInterface foundedTesteeModel = this.testeesService.find(id);
Assert.assertEquals(testeeModel, foundedTesteeModel);
}
use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testSaveInsertsModel.
@Test
public void testSaveInsertsModel() throws Exception {
final Integer id = this.testeesService.findAll().size() + 1;
final TesteeModelInterface testeeModel = Models.createTesteeModel(null, "FirstName2", "LastName2", "Surname2", 302, 19);
this.testeesService.save(testeeModel);
TesteeModelInterface foundedTesteeModel = this.testeesService.find(id);
Assert.assertEquals(testeeModel, foundedTesteeModel);
}
use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.
the class TesteesServiceTest method testSaveUpdatesModel.
@Test
public void testSaveUpdatesModel() throws Exception {
final Integer id = 1;
final TesteeModelInterface testeeModel = Models.createTesteeModel(id, "FirstName1", "LastName1", "Surname1", 301, 19);
Assert.assertNotEquals(testeeModel, this.testeesService.find(id));
this.testeesService.save(testeeModel);
Assert.assertEquals(testeeModel, this.testeesService.find(id));
}
Aggregations