use of io.crnk.test.mock.models.Task in project crnk-framework by crnk-project.
the class ExceptionTest method genericRepo.
@Test
public void genericRepo() {
Task task = new Task();
task.setId(10000L);
task.setName("test");
try {
taskRepo.create(task);
Assert.fail();
} catch (TestException e) {
Assert.assertEquals("msg", e.getMessage());
}
}
use of io.crnk.test.mock.models.Task in project crnk-framework by crnk-project.
the class QueryParamsClientTest method testDelete.
@Test
public void testDelete() {
Task task = new Task();
task.setId(1L);
task.setName("test");
taskRepo.create(task);
taskRepo.delete(1L);
List<Task> tasks = taskRepo.findAll(new QueryParams());
Assert.assertEquals(0, tasks.size());
}
use of io.crnk.test.mock.models.Task in project crnk-framework by crnk-project.
the class QueryParamsClientTest method testSaveAndFind.
@Test
public void testSaveAndFind() {
Task task = new Task();
task.setId(1L);
task.setName("test");
taskRepo.create(task);
// check retrievable with findAll
List<Task> tasks = taskRepo.findAll(new QueryParams());
Assert.assertEquals(1, tasks.size());
Task savedTask = tasks.get(0);
Assert.assertEquals(task.getId(), savedTask.getId());
Assert.assertEquals(task.getName(), savedTask.getName());
// check retrievable with findAll(ids)
tasks = taskRepo.findAll(Arrays.asList(1L), new QueryParams());
Assert.assertEquals(1, tasks.size());
savedTask = tasks.get(0);
Assert.assertEquals(task.getId(), savedTask.getId());
Assert.assertEquals(task.getName(), savedTask.getName());
// check retrievable with findOne
savedTask = taskRepo.findOne(1L, new QueryParams());
Assert.assertEquals(task.getId(), savedTask.getId());
Assert.assertEquals(task.getName(), savedTask.getName());
}
use of io.crnk.test.mock.models.Task in project crnk-framework by crnk-project.
the class QueryParamsClientTest method testGeneratedId.
@Test
public void testGeneratedId() {
Task task = new Task();
task.setId(null);
task.setName("test");
Task savedTask = taskRepo.create(task);
Assert.assertNotNull(savedTask.getId());
}
use of io.crnk.test.mock.models.Task in project crnk-framework by crnk-project.
the class QueryParamsClientTest method testFindEmpty.
@Test
public void testFindEmpty() {
List<Task> tasks = taskRepo.findAll(new QueryParams());
Assert.assertTrue(tasks.isEmpty());
}
Aggregations