use of easytests.core.options.AnswersOptionsInterface in project easy-tests by malinink.
the class AnswersServiceTest method testSaveWithOptions.
@Test
public void testSaveWithOptions() throws Exception {
final AnswerModelInterface answerModel = this.answersSupport.getModelFixtureMock(0);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
this.answersService.save(answerModel, answersOptions);
verify(answersOptions, times(1)).saveWithRelations(answerModel);
verifyNoMoreInteractions(this.answersMapper);
}
use of easytests.core.options.AnswersOptionsInterface in project easy-tests by malinink.
the class AnswersServiceTest method testDeleteModelListWithOptions.
@Test
public void testDeleteModelListWithOptions() throws Exception {
final ArgumentCaptor<AnswerModel> answerModelCaptor = ArgumentCaptor.forClass(AnswerModel.class);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
final List<AnswerModelInterface> answersModels = getAnswersFixturesModels();
this.answersService.delete(answersModels, answersOptions);
verify(answersOptions, times(2)).deleteWithRelations(answerModelCaptor.capture());
final List<AnswerModel> capturedModels = answerModelCaptor.getAllValues();
Integer index = 0;
for (AnswerModelInterface answerModel : answersModels) {
this.answersSupport.assertEquals(answerModel, capturedModels.get(index));
index++;
}
verifyNoMoreInteractions(this.answersMapper);
}
use of easytests.core.options.AnswersOptionsInterface in project easy-tests by malinink.
the class AnswersServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final Integer id = 1;
final AnswerEntity answerEntity = this.createAnswerEntityMock(id, "NewAnswer", 1, 1, true);
final AnswerModelInterface answerModel = this.mapAnswerModel(answerEntity);
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
given(this.answersMapper.find(id)).willReturn(answerEntity);
given(answersOptions.withRelations(answerModel)).willReturn(answerModel);
final AnswerModelInterface foundedAnswerModel = this.answersService.find(id, answersOptions);
verify(answersOptions).withRelations(answerModel);
Assert.assertNotNull(foundedAnswerModel);
Assert.assertEquals(answerModel, foundedAnswerModel);
}
use of easytests.core.options.AnswersOptionsInterface in project easy-tests by malinink.
the class AnswersController method getAnswerModelList.
private List<AnswerModelInterface> getAnswerModelList(QuestionModelInterface questionModel) {
final AnswersOptionsInterface answersOptions = this.answersOptionsBuilder.forAuth();
final List<AnswerModelInterface> answersList = answersService.findByQuestion(questionModel, answersOptions);
return answersList;
}
use of easytests.core.options.AnswersOptionsInterface in project easy-tests by malinink.
the class AnswersServiceTest method testSaveCreatesListEntitiesWithOptions.
@Test
public void testSaveCreatesListEntitiesWithOptions() throws Exception {
final List<AnswerModelInterface> answersModels = getAnswersAdditionalModels();
final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
this.answersService.save(answersModels, answersOptions);
Integer index = 0;
for (AnswerModelInterface answersModel : answersModels) {
verify(answersOptions, times(1)).saveWithRelations(answersModels.get(index));
index++;
}
verifyNoMoreInteractions(this.answersMapper);
}
Aggregations