use of easytests.core.options.TopicsOptionsInterface in project easy-tests by malinink.
the class TopicsServiceTest method testFindWithOptions.
@Test
public void testFindWithOptions() throws Exception {
final ArgumentCaptor<TopicModelInterface> topicModelCaptor = ArgumentCaptor.forClass(TopicModelInterface.class);
final TopicEntity topicEntity = this.topicsSupport.getEntityFixtureMock(0);
final TopicModelInterface topicModel = this.topicsSupport.getModelFixtureMock(0);
final TopicsOptionsInterface topicOptions = mock(TopicsOptionsInterface.class);
when(this.topicsMapper.find(topicModel.getId())).thenReturn(topicEntity);
when(topicOptions.withRelations(topicModelCaptor.capture())).thenReturn(topicModel);
final TopicModelInterface topicFoundedModel = this.topicsService.find(topicModel.getId(), topicOptions);
this.topicsSupport.assertEquals(topicModel, topicModelCaptor.getValue());
Assert.assertSame(topicModel, topicFoundedModel);
this.assertServicesSet(topicOptions);
}
use of easytests.core.options.TopicsOptionsInterface in project easy-tests by malinink.
the class TopicsServiceTest method testSaveModelsListWithOptions.
@Test
public void testSaveModelsListWithOptions() throws Exception {
final ArgumentCaptor<TopicModelInterface> topicModelCaptor = ArgumentCaptor.forClass(TopicModelInterface.class);
final List<TopicModelInterface> topicsModels = this.getTopicsFixturesModels();
final TopicsOptionsInterface topicsOptions = mock(TopicsOptionsInterface.class);
this.topicsService.save(topicsModels, topicsOptions);
this.assertServicesSet(topicsOptions, topicsModels.size());
verify(topicsOptions, times(topicsModels.size())).saveWithRelations(topicModelCaptor.capture());
this.topicsSupport.assertModelsListEquals(topicsModels, topicModelCaptor.getAllValues());
verifyNoMoreInteractions(this.topicsMapper);
}
use of easytests.core.options.TopicsOptionsInterface in project easy-tests by malinink.
the class TopicsServiceTest method testFindBySubjectWithOptions.
@Test
public void testFindBySubjectWithOptions() throws Exception {
final ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class);
final List<TopicEntity> topicsEntities = this.getTopicsFixturesEntities();
final List<TopicModelInterface> topicsModels = this.getTopicsFixturesModels();
final TopicsOptionsInterface topicOptions = mock(TopicsOptionsInterface.class);
final SubjectModelInterface subjectModel = this.subjectsSupport.getModelFixtureMock(0);
when(this.topicsMapper.findBySubjectId(subjectModel.getId())).thenReturn(topicsEntities);
when(topicOptions.withRelations(listCaptor.capture())).thenReturn(topicsModels);
final List<TopicModelInterface> topicsFoundedModels = this.topicsService.findBySubject(subjectModel, topicOptions);
this.topicsSupport.assertModelsListEquals(topicsModels, listCaptor.getValue());
Assert.assertSame(topicsModels, topicsFoundedModels);
this.assertServicesSet(topicOptions);
}
use of easytests.core.options.TopicsOptionsInterface in project easy-tests by malinink.
the class TopicsServiceTest method testDeleteWithOptions.
@Test
public void testDeleteWithOptions() throws Exception {
final TopicModelInterface topicModel = this.topicsSupport.getModelFixtureMock(0);
final TopicsOptionsInterface topicOptions = mock(TopicsOptionsInterface.class);
this.topicsService.delete(topicModel, topicOptions);
verify(topicOptions, times(1)).deleteWithRelations(topicModel);
this.assertServicesSet(topicOptions);
verifyNoMoreInteractions(this.topicsMapper);
}
use of easytests.core.options.TopicsOptionsInterface in project easy-tests by malinink.
the class TopicsServiceTest method testDeleteModelsListWithOptions.
@Test
public void testDeleteModelsListWithOptions() throws Exception {
final ArgumentCaptor<TopicModelInterface> topicModelCaptor = ArgumentCaptor.forClass(TopicModelInterface.class);
final List<TopicModelInterface> topicsModels = this.getTopicsFixturesModels();
final TopicsOptionsInterface topicsOptions = mock(TopicsOptionsInterface.class);
this.topicsService.delete(topicsModels, topicsOptions);
this.assertServicesSet(topicsOptions, topicsModels.size());
verify(topicsOptions, times(topicsModels.size())).deleteWithRelations(topicModelCaptor.capture());
this.topicsSupport.assertModelsListEquals(topicsModels, topicModelCaptor.getAllValues());
verifyNoMoreInteractions(this.topicsMapper);
}
Aggregations