use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final TopicEntity topicExistentEntity = this.topicsSupport.getEntityFixtureMock(0);
when(this.topicsMapper.find(topicExistentEntity.getId())).thenReturn(topicExistentEntity);
final TopicModelInterface topicFoundedModel = this.topicsService.find(topicExistentEntity.getId());
this.topicsSupport.assertEquals(this.topicsSupport.getModelFixtureMock(0), topicFoundedModel);
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsServiceTest method testFindAllWithOptions.
@Test
public void testFindAllWithOptions() throws Exception {
final ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class);
final List<TopicEntity> topicsEntities = this.getTopicsFixturesEntities();
final List<TopicModelInterface> topicsModels = this.getTopicsFixturesModels();
final TopicsOptionsInterface topicsOptions = mock(TopicsOptionsInterface.class);
when(this.topicsMapper.findAll()).thenReturn(topicsEntities);
when(topicsOptions.withRelations(listCaptor.capture())).thenReturn(topicsModels);
final List<TopicModelInterface> topicsFoundedModels = this.topicsService.findAll(topicsOptions);
this.topicsSupport.assertModelsListEquals(topicsModels, listCaptor.getValue());
Assert.assertSame(topicsModels, topicsFoundedModels);
this.assertServicesSet(topicsOptions);
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsSupport method assertModelsListEquals.
public void assertModelsListEquals(List<TopicModelInterface> expected, List<TopicModelInterface> actual) {
Assert.assertEquals(expected.size(), actual.size());
Integer i = 0;
for (TopicModelInterface topicModel : expected) {
this.assertEquals(topicModel, actual.get(i));
i++;
}
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicsSupport method getModelMock.
private TopicModelInterface getModelMock(Integer id, String name, Integer subjectId) {
final TopicModelInterface topicModelMock = Mockito.mock(TopicModelInterface.class);
Mockito.when(topicModelMock.getId()).thenReturn(id);
Mockito.when(topicModelMock.getName()).thenReturn(name);
Mockito.when(topicModelMock.getSubject()).thenReturn(new SubjectModelEmpty(subjectId));
Mockito.when(topicModelMock.getQuestions()).thenReturn(new ModelsListEmpty());
return topicModelMock;
}
use of easytests.core.models.TopicModelInterface in project easy-tests by malinink.
the class TopicEntityTest method testMap.
@Test
public void testMap() throws Exception {
final TopicModelInterface topicModelMock = this.topicsSupport.getModelFixtureMock(0);
final TopicEntity topicEntity = new TopicEntity();
topicEntity.map(topicModelMock);
this.topicsSupport.assertEquals(topicModelMock, topicEntity);
}
Aggregations