Search in sources :

Example 16 with TopicsServiceInterface

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);
}
Also used : IssueStandardsServiceInterface(easytests.core.services.IssueStandardsServiceInterface) IssueStandardTopicPriorityModelInterface(easytests.core.models.IssueStandardTopicPriorityModelInterface) TopicsServiceInterface(easytests.core.services.TopicsServiceInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 17 with TopicsServiceInterface

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);
}
Also used : QuestionTypesServiceInterface(easytests.core.services.QuestionTypesServiceInterface) QuestionModelInterface(easytests.core.models.QuestionModelInterface) TopicsServiceInterface(easytests.core.services.TopicsServiceInterface) AnswersServiceInterface(easytests.core.services.AnswersServiceInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 18 with TopicsServiceInterface

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);
}
Also used : InOrder(org.mockito.InOrder) QuestionModelInterface(easytests.core.models.QuestionModelInterface) ArrayList(java.util.ArrayList) AnswersServiceInterface(easytests.core.services.AnswersServiceInterface) TopicModelInterface(easytests.core.models.TopicModelInterface) QuestionsServiceInterface(easytests.core.services.QuestionsServiceInterface) TopicsServiceInterface(easytests.core.services.TopicsServiceInterface) AnswerModelInterface(easytests.core.models.AnswerModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TopicsServiceInterface (easytests.core.services.TopicsServiceInterface)18 Test (org.junit.Test)18 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)18 TopicModelInterface (easytests.core.models.TopicModelInterface)16 ArrayList (java.util.ArrayList)11 QuestionModelInterface (easytests.core.models.QuestionModelInterface)10 QuestionsServiceInterface (easytests.core.services.QuestionsServiceInterface)7 InOrder (org.mockito.InOrder)6 SubjectModelInterface (easytests.core.models.SubjectModelInterface)5 AnswersServiceInterface (easytests.core.services.AnswersServiceInterface)5 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)5 AnswerModelInterface (easytests.core.models.AnswerModelInterface)4 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)4 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)3 SubjectModel (easytests.core.models.SubjectModel)3 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)3 QuestionTypesServiceInterface (easytests.core.services.QuestionTypesServiceInterface)3 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)2 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)2 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)2