use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testSaveUpdateEntityIdOnCreation.
@Test
public void testSaveUpdateEntityIdOnCreation() throws Exception {
final Integer id = 10;
final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsSupport.getModelAdditionalMock(0);
doAnswer(invocations -> {
final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = (IssueStandardQuestionTypeOptionEntity) invocations.getArguments()[0];
questionTypeOptionEntity.setId(id);
return null;
}).when(this.questionTypeOptionsMapper).insert(any());
this.questionTypeOptionsService.save(questionTypeOptionModel);
verify(questionTypeOptionModel, times(1)).setId(id);
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModelCaptor = ArgumentCaptor.forClass(IssueStandardQuestionTypeOptionModelInterface.class);
final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionFixturesModels();
final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
this.questionTypeOptionsService.delete(questionTypeOptionModels, questionTypeOptionsOptions);
this.assertServicesSet(questionTypeOptionsOptions, questionTypeOptionModels.size());
verify(questionTypeOptionsOptions, times(questionTypeOptionModels.size())).deleteWithRelations(questionTypeOptionModelCaptor.capture());
this.questionTypeOptionsSupport.assertModelsListEquals(questionTypeOptionModels, questionTypeOptionModelCaptor.getAllValues());
verifyNoMoreInteractions(this.questionTypeOptionsMapper);
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsSupport method getModelMock.
private IssueStandardQuestionTypeOptionModelInterface getModelMock(Integer id, Integer questionType, Integer minQuestions, Integer maxQuestions, Integer timeLimit, Integer issueStandardId) {
final IssueStandardQuestionTypeOptionModelInterface issueStandardQuestionTypeOptionModel = Mockito.mock(IssueStandardQuestionTypeOptionModelInterface.class);
Mockito.when(issueStandardQuestionTypeOptionModel.getId()).thenReturn(id);
Mockito.when(issueStandardQuestionTypeOptionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionType));
Mockito.when(issueStandardQuestionTypeOptionModel.getMinQuestions()).thenReturn(minQuestions);
Mockito.when(issueStandardQuestionTypeOptionModel.getMaxQuestions()).thenReturn(maxQuestions);
Mockito.when(issueStandardQuestionTypeOptionModel.getTimeLimit()).thenReturn(timeLimit);
Mockito.when(issueStandardQuestionTypeOptionModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty(issueStandardId));
return issueStandardQuestionTypeOptionModel;
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsService method map.
private IssueStandardQuestionTypeOptionModelInterface map(IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity) {
final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = new IssueStandardQuestionTypeOptionModel();
questionTypeOptionModel.map(questionTypeOptionEntity);
return questionTypeOptionModel;
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionEntityTest method testMap.
@Test
public void testMap() throws Exception {
final Integer id = 3;
final Integer questionTypeId = 4;
final Integer minQuestions = 10;
final Integer maxQuestions = 20;
final Integer timeLimit = 600;
final Integer issueStandardId = 12;
final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = Mockito.mock(IssueStandardQuestionTypeOptionModelInterface.class);
Mockito.when(questionTypeOptionModel.getId()).thenReturn(id);
Mockito.when(questionTypeOptionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionTypeId));
Mockito.when(questionTypeOptionModel.getMinQuestions()).thenReturn(minQuestions);
Mockito.when(questionTypeOptionModel.getMaxQuestions()).thenReturn(maxQuestions);
Mockito.when(questionTypeOptionModel.getTimeLimit()).thenReturn(timeLimit);
Mockito.when(questionTypeOptionModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty(issueStandardId));
final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = new IssueStandardQuestionTypeOptionEntity();
questionTypeOptionEntity.map(questionTypeOptionModel);
Assert.assertEquals(id, questionTypeOptionEntity.getId());
Assert.assertEquals(questionTypeId, questionTypeOptionEntity.getQuestionTypeId());
Assert.assertEquals(minQuestions, questionTypeOptionEntity.getMinQuestions());
Assert.assertEquals(maxQuestions, questionTypeOptionEntity.getMaxQuestions());
Assert.assertEquals(timeLimit, questionTypeOptionEntity.getTimeLimit());
Assert.assertEquals(issueStandardId, questionTypeOptionEntity.getIssueStandardId());
}
Aggregations