Search in sources :

Example 11 with PointsServiceInterface

use of easytests.core.services.PointsServiceInterface in project easy-tests by malinink.

the class SolutionsOptionsTest method testWithRelationsOnNull.

@Test
public void testWithRelationsOnNull() throws Exception {
    final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
    final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
    final AnswersServiceInterface answersService = Mockito.mock(AnswersServiceInterface.class);
    solutionsOptions.setPointsService(pointsService);
    solutionsOptions.setAnswersService(answersService);
    final SolutionModelInterface nullSolutionModel = null;
    final SolutionModelInterface solutionModelWithRelations = solutionsOptions.withRelations(nullSolutionModel);
    Assert.assertNull(solutionModelWithRelations);
}
Also used : SolutionModelInterface(easytests.core.models.SolutionModelInterface) PointsServiceInterface(easytests.core.services.PointsServiceInterface) AnswersServiceInterface(easytests.core.services.AnswersServiceInterface) Test(org.junit.Test)

Example 12 with PointsServiceInterface

use of easytests.core.services.PointsServiceInterface in project easy-tests by malinink.

the class SolutionsOptionsTest method testSaveWithRelations.

@Test
public void testSaveWithRelations() throws Exception {
    final SolutionModelInterface solutionModel = Mockito.mock(SolutionModelInterface.class);
    final SolutionsOptionsInterface solutionsOptions = new SolutionsOptions();
    final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
    final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
    final SolutionsServiceInterface solutionsService = Mockito.mock(SolutionsServiceInterface.class);
    final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
    final AnswersServiceInterface answersService = Mockito.mock(AnswersServiceInterface.class);
    solutionsOptions.setSolutionsService(solutionsService);
    solutionsOptions.setPointsService(pointsService);
    solutionsOptions.withPoint(pointsOptions);
    solutionsOptions.setAnswersService(answersService);
    solutionsOptions.withAnswer(answersOptions);
    final PointModelInterface pointModel = Mockito.mock(PointModelInterface.class);
    final AnswerModelInterface answerModel = Mockito.mock(AnswerModelInterface.class);
    solutionModel.setPoint(pointModel);
    solutionModel.setAnswer(answerModel);
    final InOrder inOrder = Mockito.inOrder(solutionsService, pointsService, answersService);
    solutionsOptions.saveWithRelations(solutionModel);
    inOrder.verify(solutionsService).save(solutionModel);
    inOrder.verify(pointsService).save(solutionModel.getPoint(), pointsOptions);
    inOrder.verify(answersService).save(solutionModel.getAnswer(), answersOptions);
}
Also used : SolutionModelInterface(easytests.core.models.SolutionModelInterface) InOrder(org.mockito.InOrder) PointsServiceInterface(easytests.core.services.PointsServiceInterface) AnswersServiceInterface(easytests.core.services.AnswersServiceInterface) AnswerModelInterface(easytests.core.models.AnswerModelInterface) PointModelInterface(easytests.core.models.PointModelInterface) SolutionsServiceInterface(easytests.core.services.SolutionsServiceInterface) Test(org.junit.Test)

Example 13 with PointsServiceInterface

use of easytests.core.services.PointsServiceInterface in project easy-tests by malinink.

the class SolutionsOptionsTest method testDeleteWithRelations.

@Test
public void testDeleteWithRelations() throws Exception {
    final SolutionModelInterface solutionModel = Mockito.mock(SolutionModelInterface.class);
    final SolutionsOptionsInterface solutionsOptions = new SolutionsOptions();
    final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
    final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
    final SolutionsServiceInterface solutionsService = Mockito.mock(SolutionsServiceInterface.class);
    final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
    final AnswersServiceInterface answersService = Mockito.mock(AnswersServiceInterface.class);
    solutionsOptions.setSolutionsService(solutionsService);
    solutionsOptions.setPointsService(pointsService);
    solutionsOptions.withPoint(pointsOptions);
    solutionsOptions.setAnswersService(answersService);
    solutionsOptions.withAnswer(answersOptions);
    final PointModelInterface pointModel = Mockito.mock(PointModelInterface.class);
    final AnswerModelInterface answerModel = Mockito.mock(AnswerModelInterface.class);
    solutionModel.setPoint(pointModel);
    solutionModel.setAnswer(answerModel);
    final InOrder inOrder = Mockito.inOrder(pointsService, answersService, solutionsService);
    solutionsOptions.deleteWithRelations(solutionModel);
    inOrder.verify(pointsService).delete(solutionModel.getPoint(), pointsOptions);
    // inOrder.verify(answersService).delete(solutionModel.getAnswer(), answersOptions);
    inOrder.verify(solutionsService).delete(solutionModel);
}
Also used : SolutionModelInterface(easytests.core.models.SolutionModelInterface) InOrder(org.mockito.InOrder) PointsServiceInterface(easytests.core.services.PointsServiceInterface) AnswersServiceInterface(easytests.core.services.AnswersServiceInterface) AnswerModelInterface(easytests.core.models.AnswerModelInterface) PointModelInterface(easytests.core.models.PointModelInterface) SolutionsServiceInterface(easytests.core.services.SolutionsServiceInterface) Test(org.junit.Test)

Aggregations

PointsServiceInterface (easytests.core.services.PointsServiceInterface)13 Test (org.junit.Test)13 PointModelInterface (easytests.core.models.PointModelInterface)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 QuizModelInterface (easytests.core.models.QuizModelInterface)7 SolutionModelInterface (easytests.core.models.SolutionModelInterface)7 ArrayList (java.util.ArrayList)6 InOrder (org.mockito.InOrder)6 AnswersServiceInterface (easytests.core.services.AnswersServiceInterface)5 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)5 SolutionsServiceInterface (easytests.core.services.SolutionsServiceInterface)5 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)5 TesteeModelInterface (easytests.core.models.TesteeModelInterface)4 AnswerModelInterface (easytests.core.models.AnswerModelInterface)3 IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)3 IssueModelInterface (easytests.core.models.IssueModelInterface)2 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)2 AnswerModelEmpty (easytests.core.models.empty.AnswerModelEmpty)1 PointModelEmpty (easytests.core.models.empty.PointModelEmpty)1