use of easytests.core.models.AnswerModelInterface 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.models.AnswerModelInterface in project easy-tests by malinink.
the class AnswersServiceTest method testSaveUpdatesEntity.
@Test
public void testSaveUpdatesEntity() throws Exception {
final AnswerModelInterface answerModel = this.createAnswerModel(1, "Answer22", 1, 1, true);
this.answersService.save(answerModel);
verify(this.answersMapper, times(1)).update(this.mapAnswerEntity(answerModel));
}
use of easytests.core.models.AnswerModelInterface 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;
}
use of easytests.core.models.AnswerModelInterface in project easy-tests by malinink.
the class AnswersServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final AnswerEntity answerEntity = this.createAnswerEntityMock(id, "NewAnswer", 1, 1, true);
given(this.answersMapper.find(id)).willReturn(answerEntity);
final AnswerModelInterface answerModel = this.answersService.find(id);
Assert.assertEquals(this.mapAnswerModel(answerEntity), answerModel);
}
use of easytests.core.models.AnswerModelInterface in project easy-tests by malinink.
the class AnswersServiceTest method testDeleteUnidentifiedModel.
@Test
public void testDeleteUnidentifiedModel() throws Exception {
final AnswerModelInterface answerModel = this.createAnswerModel(null, "Answer4", 1, 1, true);
exception.expect(DeleteUnidentifiedModelException.class);
this.answersService.delete(answerModel);
}
Aggregations