Search in sources :

Example 1 with AnswerModel

use of easytests.core.models.AnswerModel 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);
}
Also used : AnswerModel(easytests.core.models.AnswerModel) AnswerModelInterface(easytests.core.models.AnswerModelInterface) AnswersOptionsInterface(easytests.core.options.AnswersOptionsInterface)

Example 2 with AnswerModel

use of easytests.core.models.AnswerModel in project easy-tests by malinink.

the class AnswersServiceTest method mapAnswerModel.

private AnswerModelInterface mapAnswerModel(AnswerEntity answerEntity) {
    final AnswerModelInterface answerModel = new AnswerModel();
    answerModel.map(answerEntity);
    return answerModel;
}
Also used : AnswerModel(easytests.core.models.AnswerModel) AnswerModelInterface(easytests.core.models.AnswerModelInterface)

Example 3 with AnswerModel

use of easytests.core.models.AnswerModel in project easy-tests by malinink.

the class AnswerListDto method mapInto.

public void mapInto(QuestionModelInterface questionModel) {
    final List<AnswerDto> answerDtoList = this.getAnswersList();
    final List<AnswerModelInterface> answers = new ArrayList<>(this.getAnswersList().size());
    for (AnswerDto answerDto : answerDtoList) {
        final AnswerModelInterface answer = new AnswerModel();
        answerDto.mapInto(answer);
        answers.add(answer);
    }
    questionModel.setAnswers(answers);
}
Also used : AnswerModel(easytests.core.models.AnswerModel) ArrayList(java.util.ArrayList) AnswerModelInterface(easytests.core.models.AnswerModelInterface)

Example 4 with AnswerModel

use of easytests.core.models.AnswerModel in project easy-tests by malinink.

the class AnswersServiceTest method testDeleteModelWithOptions.

@Test
public void testDeleteModelWithOptions() throws Exception {
    final ArgumentCaptor<AnswerModel> answerModelCaptor = ArgumentCaptor.forClass(AnswerModel.class);
    final AnswersOptionsInterface answersOptions = Mockito.mock(AnswersOptionsInterface.class);
    this.answersService.delete(this.answersSupport.getModelFixtureMock(0), answersOptions);
    verify(answersOptions, times(1)).deleteWithRelations(answerModelCaptor.capture());
    this.answersSupport.assertEquals(this.answersSupport.getModelFixtureMock(0), answerModelCaptor.getValue());
    verifyNoMoreInteractions(this.answersMapper);
}
Also used : AnswerModel(easytests.core.models.AnswerModel) AnswersOptionsInterface(easytests.core.options.AnswersOptionsInterface)

Example 5 with AnswerModel

use of easytests.core.models.AnswerModel in project easy-tests by malinink.

the class AnswersService method map.

private AnswerModelInterface map(AnswerEntity answerEntity) {
    final AnswerModelInterface answerModel = new AnswerModel();
    answerModel.map(answerEntity);
    return answerModel;
}
Also used : AnswerModel(easytests.core.models.AnswerModel) AnswerModelInterface(easytests.core.models.AnswerModelInterface)

Aggregations

AnswerModel (easytests.core.models.AnswerModel)7 AnswerModelInterface (easytests.core.models.AnswerModelInterface)6 AnswersOptionsInterface (easytests.core.options.AnswersOptionsInterface)2 QuestionModelInterface (easytests.core.models.QuestionModelInterface)1 ArrayList (java.util.ArrayList)1