Search in sources :

Example 6 with IssuesServiceInterface

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

the class QuizzesOptionsTest method testWithRelationsOnNull.

@Test
public void testWithRelationsOnNull() throws Exception {
    final QuizzesOptionsInterface quizzesOptions = new QuizzesOptions();
    final TesteesServiceInterface testeesService = Mockito.mock(TesteesServiceInterface.class);
    final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
    final IssuesServiceInterface issuesService = Mockito.mock(IssuesServiceInterface.class);
    final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
    final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
    final IssuesOptionsInterface issueOptions = Mockito.mock(IssuesOptionsInterface.class);
    quizzesOptions.setTesteesService(testeesService);
    quizzesOptions.setPointsService(pointsService);
    quizzesOptions.setIssuesService(issuesService);
    quizzesOptions.withPoints(pointsOptions).withIssue(issueOptions).withTestee(testeesOptions);
    final QuizModelInterface nullQuizModel = null;
    final QuizModelInterface quizModelWithRelations = quizzesOptions.withRelations(nullQuizModel);
    Assert.assertNull(quizModelWithRelations);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) IssuesServiceInterface(easytests.core.services.IssuesServiceInterface) PointsServiceInterface(easytests.core.services.PointsServiceInterface) TesteesServiceInterface(easytests.core.services.TesteesServiceInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with IssuesServiceInterface

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

the class IssuesOptionsTest method testDeleteWithRelations.

@Test
public void testDeleteWithRelations() throws Exception {
    final IssueModelInterface issueModel = Mockito.mock(IssueModelInterface.class);
    final IssuesOptionsInterface issuesOptions = new IssuesOptions();
    final IssuesServiceInterface issuesService = Mockito.mock(IssuesServiceInterface.class);
    final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
    final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
    issuesOptions.setIssuesService(issuesService);
    issuesOptions.setQuizzesService(quizzesService);
    issuesOptions.withQuizzes(quizzesOptions);
    final List<QuizModelInterface> quizzesModels = new ArrayList<>();
    quizzesModels.add(Mockito.mock(QuizModelInterface.class));
    given(issueModel.getQuizzes()).willReturn(quizzesModels);
    final InOrder inOrder = Mockito.inOrder(quizzesService, issuesService);
    issuesOptions.deleteWithRelations(issueModel);
    inOrder.verify(quizzesService).delete(quizzesModels, quizzesOptions);
    inOrder.verify(issuesService).delete(issueModel);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) InOrder(org.mockito.InOrder) IssuesServiceInterface(easytests.core.services.IssuesServiceInterface) QuizzesServiceInterface(easytests.core.services.QuizzesServiceInterface) ArrayList(java.util.ArrayList) IssueModelInterface(easytests.core.models.IssueModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)7 Test (org.junit.Test)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 QuizModelInterface (easytests.core.models.QuizModelInterface)6 IssueModelInterface (easytests.core.models.IssueModelInterface)5 ArrayList (java.util.ArrayList)4 PointsServiceInterface (easytests.core.services.PointsServiceInterface)3 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)3 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)3 PointModelInterface (easytests.core.models.PointModelInterface)2 TesteeModelInterface (easytests.core.models.TesteeModelInterface)2 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)2 InOrder (org.mockito.InOrder)2 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)1