use of easytests.core.options.TesteesOptionsInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(id, "NewFirstName", "NewLastName1", "NewSurname1", 307, 7);
final TesteeModelInterface testeeModel = this.mapTesteeModel(testeeEntity);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
given(this.testeesMapper.find(id)).willReturn(testeeEntity);
given(testeesOptions.withRelations(testeeModel)).willReturn(testeeModel);
final TesteeModelInterface foundedTesteeModel = this.testeesService.find(id, testeesOptions);
Assert.assertEquals(testeeModel, foundedTesteeModel);
verify(testeesOptions).withRelations(testeeModel);
}
use of easytests.core.options.TesteesOptionsInterface in project easy-tests by malinink.
the class TesteesServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final TesteeModelInterface testeeModel = Models.createTesteeModel(null, "FirstName", "LastName", "Surname", 301, 1);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
this.testeesService.save(testeeModel, testeesOptions);
verify(testeesOptions).saveWithRelations(testeeModel);
}
use of easytests.core.options.TesteesOptionsInterface in project easy-tests by malinink.
the class TesteesServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final TesteeModelInterface testeeModel = Models.createTesteeModel(1, "FirstName", "LastName", "Surname", 301, 1);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
this.testeesService.delete(testeeModel, testeesOptions);
verify(testeesOptions).deleteWithRelations(testeeModel);
}
use of easytests.core.options.TesteesOptionsInterface in project easy-tests by malinink.
the class TesteesServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final List<TesteeEntity> testeesEntities = this.getTesteesEntities();
final List<TesteeModelInterface> testeesModels = this.getTesteesModels();
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
given(this.testeesMapper.findAll()).willReturn(testeesEntities);
given(testeesOptions.withRelations(Mockito.anyList())).willReturn(testeesModels);
final List<TesteeModelInterface> foundedTesteesModels = this.testeesService.findAll(testeesOptions);
verify(testeesOptions).withRelations(testeesModels);
Assert.assertEquals(testeesModels, foundedTesteesModels);
}
use of easytests.core.options.TesteesOptionsInterface 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);
}
Aggregations