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