use of io.crnk.core.repository.decorate.ResourceRepositoryDecoratorBase in project crnk-framework by crnk-project.
the class DecoratorTest method testResourceRegistryAwareDecoration.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testResourceRegistryAwareDecoration() {
RegistryAwareResourceRepository repository = Mockito.mock(RegistryAwareResourceRepository.class);
ResourceRepositoryDecoratorBase<Schedule, Long> decorator = new ResourceRepositoryDecoratorBase() {
};
decorator.setDecoratedObject(repository);
ResourceRegistry resourceRegistry = Mockito.mock(ResourceRegistry.class);
decorator.setResourceRegistry(resourceRegistry);
Mockito.verify(repository, Mockito.times(1)).setResourceRegistry(Mockito.eq(resourceRegistry));
}
use of io.crnk.core.repository.decorate.ResourceRepositoryDecoratorBase in project crnk-framework by crnk-project.
the class DecoratorTest method testDecoratedResourceRepositoryBase.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testDecoratedResourceRepositoryBase() {
ScheduleRepository repository = Mockito.mock(ScheduleRepository.class);
ResourceRepositoryDecoratorBase<Schedule, Long> decorator = new ResourceRepositoryDecoratorBase() {
};
decorator.setDecoratedObject(repository);
decorator.create(null);
Mockito.verify(repository, Mockito.times(1)).create(Mockito.any(Schedule.class));
decorator.delete(null);
Mockito.verify(repository, Mockito.times(1)).delete(Mockito.anyLong());
decorator.findAll(null);
Mockito.verify(repository, Mockito.times(1)).findAll(Mockito.any(QuerySpec.class));
decorator.findAll(null, null);
Mockito.verify(repository, Mockito.times(1)).findAll(Mockito.anyListOf(Long.class), Mockito.any(QuerySpec.class));
decorator.getResourceClass();
Mockito.verify(repository, Mockito.times(1)).getResourceClass();
Schedule schedule = Mockito.mock(Schedule.class);
decorator.save(schedule);
Mockito.verify(repository, Mockito.times(1)).save(Mockito.eq(schedule));
decorator.findOne(null, null);
Mockito.verify(repository, Mockito.times(1)).findOne(Mockito.anyLong(), Mockito.any(QuerySpec.class));
}
Aggregations