use of easytests.core.services.QuizzesServiceInterface in project easy-tests by malinink.
the class QuizzesOptionsTest method testSaveWithRelations.
@Test
public void testSaveWithRelations() throws Exception {
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
final TesteesServiceInterface testeesService = Mockito.mock(TesteesServiceInterface.class);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
final QuizzesOptionsInterface quizzesOptions = new QuizzesOptions();
final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
quizzesOptions.setTesteesService(testeesService);
quizzesOptions.setQuizzesService(quizzesService);
quizzesOptions.setPointsService(pointsService);
quizzesOptions.withTestee(testeesOptions);
quizzesOptions.withPoints(pointsOptions);
final List<PointModelInterface> pointsModels = new ArrayList<>();
quizModel.setPoints(pointsModels);
final TesteeModelInterface testeeModel = Mockito.mock(TesteeModelInterface.class);
quizModel.setTestee(testeeModel);
final InOrder inOrder = Mockito.inOrder(quizzesService, testeesService, pointsService);
quizzesOptions.saveWithRelations(quizModel);
inOrder.verify(quizzesService).save(quizModel);
inOrder.verify(testeesService).save(quizModel.getTestee(), testeesOptions);
inOrder.verify(pointsService).save(quizModel.getPoints(), pointsOptions);
}
use of easytests.core.services.QuizzesServiceInterface in project easy-tests by malinink.
the class QuizzesOptionsTest method testDeleteWithRelations.
@Test
public void testDeleteWithRelations() throws Exception {
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
final TesteesServiceInterface testeesService = Mockito.mock(TesteesServiceInterface.class);
final TesteesOptionsInterface testeesOptions = Mockito.mock(TesteesOptionsInterface.class);
final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
final QuizzesOptionsInterface quizzesOptions = new QuizzesOptions();
final PointsServiceInterface pointsService = Mockito.mock(PointsServiceInterface.class);
final PointsOptionsInterface pointsOptions = Mockito.mock(PointsOptionsInterface.class);
quizzesOptions.setTesteesService(testeesService);
quizzesOptions.setQuizzesService(quizzesService);
quizzesOptions.setPointsService(pointsService);
quizzesOptions.withPoints(pointsOptions);
quizzesOptions.withTestee(testeesOptions);
final List<PointModelInterface> pointsModels = new ArrayList<>();
quizModel.setPoints(pointsModels);
final TesteeModelInterface testeeModel = Mockito.mock(TesteeModelInterface.class);
quizModel.setTestee(testeeModel);
final InOrder inOrder = Mockito.inOrder(pointsService, quizzesService, testeesService);
quizzesOptions.deleteWithRelations(quizModel);
inOrder.verify(pointsService).delete(quizModel.getPoints(), pointsOptions);
inOrder.verify(quizzesService).delete(quizModel);
inOrder.verify(testeesService).delete(quizModel.getTestee(), testeesOptions);
}
use of easytests.core.services.QuizzesServiceInterface in project easy-tests by malinink.
the class QuizzesOptionsTest method testSaveDeleteWithIssue.
@Test
public void testSaveDeleteWithIssue() {
final QuizzesOptionsInterface quizzesOptions = new QuizzesOptions();
final IssuesOptionsInterface issuesOptions = Mockito.mock(IssuesOptionsInterface.class);
final IssuesServiceInterface issuesService = Mockito.mock(IssuesServiceInterface.class);
final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
quizzesOptions.setQuizzesService(quizzesService);
quizzesOptions.setIssuesService(issuesService);
quizzesOptions.withIssue(issuesOptions);
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
final QuizzesOptionsInterface quizzesOptionsSpy = Mockito.spy(quizzesOptions);
quizzesOptionsSpy.deleteWithRelations(quizModel);
verify(issuesService, times(1)).delete(quizModel.getIssue(), issuesOptions);
quizzesOptionsSpy.saveWithRelations(quizModel);
verify(issuesService, times(1)).save(quizModel.getIssue(), issuesOptions);
}
use of easytests.core.services.QuizzesServiceInterface in project easy-tests by malinink.
the class TesteesOptionsTest method testSaveWithRelations.
@Test
public void testSaveWithRelations() throws Exception {
final TesteeModelInterface testeeModel = Mockito.mock(TesteeModelInterface.class);
final TesteesOptionsInterface testeesOptions = new TesteesOptions();
final TesteesServiceInterface testeesService = Mockito.mock(TesteesServiceInterface.class);
final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
final Integer quizId = 3;
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
Mockito.when(quizModel.getId()).thenReturn(quizId);
Mockito.when(testeeModel.getQuiz()).thenReturn(quizModel);
testeesOptions.setTesteesService(testeesService);
testeesOptions.setQuizzesService(quizzesService);
testeesOptions.withQuiz(quizzesOptions);
final InOrder inOrder = Mockito.inOrder(quizzesService, testeesService);
testeesOptions.saveWithRelations(testeeModel);
inOrder.verify(quizzesService, times(1)).save(testeeModel.getQuiz(), quizzesOptions);
inOrder.verify(testeesService, times(1)).save(testeeModel);
}
use of easytests.core.services.QuizzesServiceInterface in project easy-tests by malinink.
the class TesteesOptionsTest method testDeleteWithRelations.
@Test
public void testDeleteWithRelations() throws Exception {
final TesteeModelInterface testeeModel = Mockito.mock(TesteeModelInterface.class);
final TesteesOptionsInterface testeesOptions = new TesteesOptions();
final TesteesServiceInterface testeesService = Mockito.mock(TesteesServiceInterface.class);
final QuizzesServiceInterface quizzesService = Mockito.mock(QuizzesServiceInterface.class);
final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
final Integer quizId = 3;
final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
Mockito.when(quizModel.getId()).thenReturn(quizId);
Mockito.when(testeeModel.getQuiz()).thenReturn(quizModel);
testeesOptions.setTesteesService(testeesService);
testeesOptions.setQuizzesService(quizzesService);
testeesOptions.withQuiz(quizzesOptions);
final InOrder inOrder = Mockito.inOrder(quizzesService, testeesService);
testeesOptions.deleteWithRelations(testeeModel);
inOrder.verify(quizzesService, times(1)).delete(testeeModel.getQuiz(), quizzesOptions);
inOrder.verify(testeesService, times(1)).delete(testeeModel);
}
Aggregations