Search in sources :

Example 1 with TesteesOptionsInterface

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);
}
Also used : TesteesOptionsInterface(easytests.core.options.TesteesOptionsInterface) TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with TesteesOptionsInterface

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);
}
Also used : TesteesOptionsInterface(easytests.core.options.TesteesOptionsInterface) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with TesteesOptionsInterface

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);
}
Also used : TesteesOptionsInterface(easytests.core.options.TesteesOptionsInterface) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with TesteesOptionsInterface

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);
}
Also used : TesteesOptionsInterface(easytests.core.options.TesteesOptionsInterface) TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 5 with TesteesOptionsInterface

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);
}
Also used : TesteesOptionsInterface(easytests.core.options.TesteesOptionsInterface) TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TesteeModelInterface (easytests.core.models.TesteeModelInterface)5 TesteesOptionsInterface (easytests.core.options.TesteesOptionsInterface)5 Test (org.junit.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 TesteeEntity (easytests.core.entities.TesteeEntity)3