use of easytests.core.services.TopicsServiceInterface in project easy-tests by malinink.
the class IssueStandardTopicPrioritiesOptionsTest method testWithRelationsOnNull.
@Test
public void testWithRelationsOnNull() throws Exception {
final IssueStandardTopicPrioritiesOptionsInterface topicPrioritiesOptions = new IssueStandardTopicPrioritiesOptions();
final TopicsServiceInterface topicsService = Mockito.mock(TopicsServiceInterface.class);
final TopicsOptionsInterface topicsOptions = Mockito.mock(TopicsOptionsInterface.class);
final IssueStandardsServiceInterface issueStandardsService = Mockito.mock(IssueStandardsServiceInterface.class);
final IssueStandardsOptionsInterface issueStandardsOptions = Mockito.mock(IssueStandardsOptionsInterface.class);
topicPrioritiesOptions.setTopicsService(topicsService);
topicPrioritiesOptions.setIssueStandardsService(issueStandardsService);
topicPrioritiesOptions.withTopic(topicsOptions).withIssueStandard(issueStandardsOptions);
final IssueStandardTopicPriorityModelInterface topicPriorityModel = null;
final IssueStandardTopicPriorityModelInterface topicPriorityModelWithRelations = topicPrioritiesOptions.withRelations(topicPriorityModel);
Assert.assertEquals(null, topicPriorityModelWithRelations);
}
use of easytests.core.services.TopicsServiceInterface in project easy-tests by malinink.
the class QuestionsOptionsTest method testWithRelationsOnNull.
@Test
public void testWithRelationsOnNull() throws Exception {
final QuestionModelInterface questionModel = null;
final QuestionsOptionsInterface questionsOptions = new QuestionsOptions();
final AnswersServiceInterface answersService = Mockito.mock(AnswersServiceInterface.class);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
final TopicsServiceInterface topicsService = Mockito.mock(TopicsServiceInterface.class);
final TopicsOptionsInterface topicsOptions = Mockito.mock(TopicsOptionsInterface.class);
final QuestionTypesServiceInterface questionTypesService = Mockito.mock(QuestionTypesServiceInterface.class);
final QuestionTypesOptionsInterface questionTypesOptions = Mockito.mock(QuestionTypesOptionsInterface.class);
questionsOptions.setAnswersService(answersService);
questionsOptions.withAnswers(answersOptions);
questionsOptions.setTopicsService(topicsService);
questionsOptions.withTopic(topicsOptions);
questionsOptions.setQuestionTypesService(questionTypesService);
questionsOptions.withQuestionType(questionTypesOptions);
final QuestionModelInterface questionModelWithRelations = questionsOptions.withRelations(questionModel);
Assert.assertEquals(null, questionModelWithRelations);
}
use of easytests.core.services.TopicsServiceInterface in project easy-tests by malinink.
the class QuestionsOptionsTest method testSaveWithRelations.
@Test
public void testSaveWithRelations() throws Exception {
final QuestionModelInterface questionModel = Mockito.mock(QuestionModelInterface.class);
final QuestionsOptionsInterface questionsOptions = new QuestionsOptions();
final QuestionsServiceInterface questionsService = Mockito.mock(QuestionsServiceInterface.class);
final AnswersServiceInterface answersService = Mockito.mock(AnswersServiceInterface.class);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
final TopicsServiceInterface topicsService = Mockito.mock(TopicsServiceInterface.class);
final TopicsOptionsInterface topicsOptions = Mockito.mock(TopicsOptionsInterface.class);
questionsOptions.setQuestionsService(questionsService);
questionsOptions.setAnswersService(answersService);
questionsOptions.withAnswers(answersOptions);
questionsOptions.setTopicsService(topicsService);
questionsOptions.withTopic(topicsOptions);
final List<AnswerModelInterface> answersModels = new ArrayList<>();
answersModels.add(Mockito.mock(AnswerModelInterface.class));
TopicModelInterface topicModel = Mockito.mock(TopicModelInterface.class);
given(questionModel.getAnswers()).willReturn(answersModels);
given(questionModel.getTopic()).willReturn(topicModel);
final InOrder inOrder = Mockito.inOrder(topicsService, questionsService, answersService);
questionsOptions.saveWithRelations(questionModel);
inOrder.verify(topicsService).save(topicModel, topicsOptions);
inOrder.verify(questionsService).save(questionModel);
inOrder.verify(answersService).save(answersModels, answersOptions);
}
Aggregations