Search in sources :

Example 26 with TesteeModelInterface

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);
}
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 27 with TesteeModelInterface

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

Example 28 with TesteeModelInterface

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

Example 29 with TesteeModelInterface

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

Example 30 with TesteeModelInterface

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