use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testFindAbsentModel.
@Test
public void testFindAbsentModel() throws Exception {
final Integer id = 10;
given(this.questionTypeOptionsMapper.find(id)).willReturn(null);
final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsService.find(id);
Assert.assertNull(questionTypeOptionModel);
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testSaveListWithOptions.
@Test
public void testSaveListWithOptions() throws Exception {
final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionModels();
this.questionTypeOptionsService.save(questionTypeOptionModels, questionTypeOptionsOptions);
for (IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel : questionTypeOptionModels) {
verify(questionTypeOptionsOptions).saveWithRelations(questionTypeOptionModel);
}
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final List<IssueStandardQuestionTypeOptionEntity> questionTypeOptionEntities = this.getQuestionTypeOptionEntities();
final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionModels();
final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
given(this.questionTypeOptionsMapper.findAll()).willReturn(questionTypeOptionEntities);
given(questionTypeOptionsOptions.withRelations(Mockito.anyList())).willReturn(questionTypeOptionModels);
final List<IssueStandardQuestionTypeOptionModelInterface> foundedQuestionTypeOptionModels = this.questionTypeOptionsService.findAll(questionTypeOptionsOptions);
verify(questionTypeOptionsOptions).withRelations(questionTypeOptionModels);
Assert.assertNotNull(foundedQuestionTypeOptionModels);
Assert.assertEquals(questionTypeOptionModels, foundedQuestionTypeOptionModels);
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final IssueStandardQuestionTypeOptionEntity questionTypeOptionEntity = Entities.createQuestionTypeOptionEntityMock(id, 1, 10, 20, 60, 1);
given(this.questionTypeOptionsMapper.find(id)).willReturn(questionTypeOptionEntity);
final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = this.questionTypeOptionsService.find(id);
Assert.assertNotNull(questionTypeOptionModel);
Assert.assertEquals(this.mapQuestionTypeOptionModel(questionTypeOptionEntity), questionTypeOptionModel);
}
use of easytests.core.models.IssueStandardQuestionTypeOptionModelInterface in project easy-tests by malinink.
the class IssueStandardQuestionTypeOptionsServiceTest method testFindByIssueStandardAbsentList.
@Test
public void testFindByIssueStandardAbsentList() throws Exception {
final Integer issueStandardId = 10;
given(this.questionTypeOptionsMapper.findByIssueStandardId(issueStandardId)).willReturn(new ArrayList<>(0));
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.questionTypeOptionsService.findByIssueStandard(issueStandardModel);
Assert.assertNotNull(questionTypeOptionModels);
Assert.assertEquals(0, questionTypeOptionModels.size());
}
Aggregations