use of easytests.core.options.QuestionsOptionsInterface in project easy-tests by malinink.
the class QuestionsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<QuestionModelInterface> questionModelCaptor = ArgumentCaptor.forClass(QuestionModelInterface.class);
final List<QuestionModelInterface> questionsModels = this.getQuestionsFixturesModels();
final QuestionsOptionsInterface questionsOptions = Mockito.mock(QuestionsOptionsInterface.class);
this.questionsService.delete(questionsModels, questionsOptions);
this.assertServicesSet(questionsOptions, questionsModels.size());
verify(questionsOptions, times(questionsModels.size())).deleteWithRelations(questionModelCaptor.capture());
this.questionsSupport.assertModelsListEquals(questionsModels, questionModelCaptor.getAllValues());
verifyNoMoreInteractions(this.questionsMapper);
}
use of easytests.core.options.QuestionsOptionsInterface in project easy-tests by malinink.
the class QuestionsServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() throws Exception {
final ArgumentCaptor<QuestionModelInterface> questionsModelCaptor = ArgumentCaptor.forClass(QuestionModelInterface.class);
final List<QuestionModelInterface> questionsModels = this.getQuestionsFixturesModels();
final QuestionsOptionsInterface questionsOptions = Mockito.mock(QuestionsOptionsInterface.class);
this.questionsService.save(questionsModels, questionsOptions);
this.assertServicesSet(questionsOptions, questionsModels.size());
verify(questionsOptions, times(questionsModels.size())).saveWithRelations(questionsModelCaptor.capture());
this.questionsSupport.assertModelsListEquals(questionsModels, questionsModelCaptor.getAllValues());
verifyNoMoreInteractions(this.questionsMapper);
}
use of easytests.core.options.QuestionsOptionsInterface in project easy-tests by malinink.
the class QuestionsServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final QuestionModelInterface questionModel = Models.createQuestionModel(1, "Text", 1, 1);
final QuestionsOptionsInterface questionsOptions = Mockito.mock(QuestionsOptionsInterface.class);
this.questionsService.delete(questionModel, questionsOptions);
verify(questionsOptions).deleteWithRelations(questionModel);
}
use of easytests.core.options.QuestionsOptionsInterface in project easy-tests by malinink.
the class QuestionsServiceTest method testDeleteModelsList.
@Test
public void testDeleteModelsList() throws Exception {
final QuestionModelInterface questionModelFirst = Models.createQuestionModel(1, "test1", 1, 1);
final QuestionModelInterface questionModelSecond = Models.createQuestionModel(2, "test2", 2, 1);
final QuestionsOptionsInterface questionsOptions = Mockito.mock(QuestionsOptionsInterface.class);
final List<QuestionModelInterface> questionsModels = new ArrayList<>();
questionsModels.add(questionModelFirst);
questionsModels.add(questionModelSecond);
final QuestionsServiceInterface questionsServiceSpy = Mockito.spy(questionsService);
questionsServiceSpy.delete(questionsModels);
verify(questionsServiceSpy, times(1)).delete(questionModelFirst);
verify(questionsServiceSpy, times(1)).delete(questionModelSecond);
questionsServiceSpy.delete(questionsModels, questionsOptions);
verify(questionsServiceSpy, times(1)).delete(questionModelFirst, questionsOptions);
verify(questionsServiceSpy, times(1)).delete(questionModelSecond, questionsOptions);
}
use of easytests.core.options.QuestionsOptionsInterface in project easy-tests by malinink.
the class AnswersController method getQuestionModel.
private QuestionModelInterface getQuestionModel(Integer id, Boolean forDelete) {
final QuestionsOptionsInterface questionsOptions = this.questionsOptionsBuilder.forAuth().withAnswers(new AnswersOptions());
final QuestionModelInterface questionModel = this.questionsService.find(id, questionsOptions);
// checkModel(questionModel, topicId);
if (forDelete) {
return this.questionsService.find(id, this.questionsOptionsBuilder.forDelete());
}
return questionModel;
}
Aggregations