Search in sources :

Example 31 with IssueModelInterface

use of easytests.core.models.IssueModelInterface 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)

Example 32 with IssueModelInterface

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

the class IssuesOptionsTest method testWithRelationsOnNull.

@Test
public void testWithRelationsOnNull() throws Exception {
    final IssueModelInterface issueModel = null;
    final IssuesOptionsInterface issuesOptions = new IssuesOptions();
    final SubjectsServiceInterface subjectsService = Mockito.mock(SubjectsServiceInterface.class);
    final SubjectsOptionsInterface subjectsOptions = Mockito.mock(SubjectsOptionsInterface.class);
    final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
    final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
    issuesOptions.setSubjectsService(subjectsService);
    issuesOptions.setQuizzesService(quizzesService);
    issuesOptions.withSubject(subjectsOptions);
    issuesOptions.withQuizzes(quizzesOptions);
    final IssueModelInterface issueModelWithRelations = issuesOptions.withRelations(issueModel);
    Assert.assertEquals(null, issueModelWithRelations);
}
Also used : SubjectsServiceInterface(easytests.core.services.SubjectsServiceInterface) QuizzesServiceInterface(easytests.core.services.QuizzesServiceInterface) IssueModelInterface(easytests.core.models.IssueModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssueModelInterface (easytests.core.models.IssueModelInterface)32 Test (org.junit.Test)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)15 QuizModelInterface (easytests.core.models.QuizModelInterface)11 ArrayList (java.util.ArrayList)11 IssueEntity (easytests.core.entities.IssueEntity)6 IssuesOptionsInterface (easytests.core.options.IssuesOptionsInterface)6 IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)5 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)5 SubjectModelInterface (easytests.core.models.SubjectModelInterface)4 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)4 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)4 QuizEntity (easytests.core.entities.QuizEntity)3 IssueModel (easytests.core.models.IssueModel)3 PointModelInterface (easytests.core.models.PointModelInterface)2 TesteeModelInterface (easytests.core.models.TesteeModelInterface)2 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)2 PointsServiceInterface (easytests.core.services.PointsServiceInterface)2 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)2 InOrder (org.mockito.InOrder)2