Search in sources :

Example 1 with TestException

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

Example 2 with TestException

use of io.crnk.test.mock.TestException 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());
    }
}
Also used : Task(io.crnk.test.mock.models.Task) TestException(io.crnk.test.mock.TestException) Test(org.junit.Test)

Aggregations

TestException (io.crnk.test.mock.TestException)2 Test (org.junit.Test)2 Schedule (io.crnk.test.mock.models.Schedule)1 Task (io.crnk.test.mock.models.Task)1 ScheduleRepository (io.crnk.test.mock.repository.ScheduleRepository)1