Search in sources :

Example 21 with TesteeModelInterface

use of easytests.core.models.TesteeModelInterface 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 22 with TesteeModelInterface

use of easytests.core.models.TesteeModelInterface 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 23 with TesteeModelInterface

use of easytests.core.models.TesteeModelInterface 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 24 with TesteeModelInterface

use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.

the class TesteesServiceTest method testDeleteIdentifiedModel.

@Test
public void testDeleteIdentifiedModel() throws Exception {
    final TesteeModelInterface testeeModel = Models.createTesteeModel(1, "FirstName", "LastName", "Surname", 301, 1);
    this.testeesService.delete(testeeModel);
    verify(this.testeesMapper, times(1)).delete(this.mapTesteeEntity(testeeModel));
}
Also used : TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 25 with TesteeModelInterface

use of easytests.core.models.TesteeModelInterface in project easy-tests by malinink.

the class TesteesServiceTest method testFindAbsentModel.

@Test
public void testFindAbsentModel() throws Exception {
    final Integer id = 10;
    given(this.testeesMapper.find(id)).willReturn(null);
    final TesteeModelInterface testeeModel = this.testeesService.find(id);
    Assert.assertEquals(null, testeeModel);
}
Also used : TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TesteeModelInterface (easytests.core.models.TesteeModelInterface)33 Test (org.junit.Test)28 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)27 QuizModelInterface (easytests.core.models.QuizModelInterface)11 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)7 TesteeEntity (easytests.core.entities.TesteeEntity)6 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)6 TesteesOptionsInterface (easytests.core.options.TesteesOptionsInterface)5 ArrayList (java.util.ArrayList)5 PointModelInterface (easytests.core.models.PointModelInterface)4 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)4 PointsServiceInterface (easytests.core.services.PointsServiceInterface)4 InOrder (org.mockito.InOrder)4 IssueModelInterface (easytests.core.models.IssueModelInterface)2 TesteeModel (easytests.core.models.TesteeModel)2 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)2 IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)2 QuizzesOptions (easytests.core.options.QuizzesOptions)1 TesteesOptions (easytests.core.options.TesteesOptions)1