Search in sources :

Example 1 with ScheduleRepository

use of io.crnk.core.mock.repository.ScheduleRepository 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));
}
Also used : Schedule(io.crnk.core.mock.models.Schedule) ScheduleRepository(io.crnk.core.mock.repository.ScheduleRepository) ResourceRepositoryDecoratorBase(io.crnk.core.repository.decorate.ResourceRepositoryDecoratorBase) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Aggregations

Schedule (io.crnk.core.mock.models.Schedule)1 ScheduleRepository (io.crnk.core.mock.repository.ScheduleRepository)1 QuerySpec (io.crnk.core.queryspec.QuerySpec)1 ResourceRepositoryDecoratorBase (io.crnk.core.repository.decorate.ResourceRepositoryDecoratorBase)1 Test (org.junit.Test)1