use of io.crnk.test.mock.repository.ScheduleRepository in project crnk-framework by crnk-project.
the class QuerySpecClientTest method testInterfaceAccess.
@Test
public void testInterfaceAccess() {
// tag::interfaceAccess[]
ScheduleRepository scheduleRepository = client.getResourceRepository(ScheduleRepository.class);
Schedule schedule = new Schedule();
schedule.setId(13L);
schedule.setName("mySchedule");
scheduleRepository.create(schedule);
QuerySpec querySpec = new QuerySpec(Schedule.class);
ScheduleList list = scheduleRepository.findAll(querySpec);
Assert.assertEquals(1, list.size());
ScheduleListMeta meta = list.getMeta();
ScheduleListLinks links = list.getLinks();
Assert.assertNotNull(meta);
Assert.assertNotNull(links);
// end::interfaceAccess[]
}
use of io.crnk.test.mock.repository.ScheduleRepository in project crnk-framework by crnk-project.
the class RestTemplateClientTest method testCreate.
@Test
public void testCreate() {
ScheduleRepository scheduleRepository = client.getRepositoryForInterface(ScheduleRepository.class);
Schedule schedule = new Schedule();
schedule.setName("mySchedule");
scheduleRepository.create(schedule);
QuerySpec querySpec = new QuerySpec(Schedule.class);
ScheduleRepository.ScheduleList list = scheduleRepository.findAll(querySpec);
Assert.assertEquals(1, list.size());
schedule = list.get(0);
Assert.assertNotNull(schedule.getId());
ScheduleRepository.ScheduleListMeta meta = list.getMeta();
ScheduleRepository.ScheduleListLinks links = list.getLinks();
Assert.assertNotNull(meta);
Assert.assertNotNull(links);
}
use of io.crnk.test.mock.repository.ScheduleRepository in project crnk-framework by crnk-project.
the class QuerySpecClientTest method testCreate.
@Test
public void testCreate() {
ScheduleRepository scheduleRepository = client.getResourceRepository(ScheduleRepository.class);
Schedule schedule = new Schedule();
schedule.setName("mySchedule");
scheduleRepository.create(schedule);
QuerySpec querySpec = new QuerySpec(Schedule.class);
ScheduleList list = scheduleRepository.findAll(querySpec);
Assert.assertEquals(1, list.size());
schedule = list.get(0);
Assert.assertNotNull(schedule.getId());
ScheduleListMeta meta = list.getMeta();
ScheduleListLinks links = list.getLinks();
Assert.assertNotNull(meta);
Assert.assertNotNull(links);
}
use of io.crnk.test.mock.repository.ScheduleRepository in project crnk-framework by crnk-project.
the class ExceptionTest method repoWithProxyAndInterface.
@Test
public void repoWithProxyAndInterface() {
ScheduleRepository repo = client.getRepositoryForInterface(ScheduleRepository.class);
Schedule schedule = new Schedule();
schedule.setId(10000L);
schedule.setName("test");
try {
repo.create(schedule);
Assert.fail();
} catch (TestException e) {
Assert.assertEquals("msg", e.getMessage());
}
}
Aggregations