use of io.crnk.operations.server.OperationFilter in project crnk-framework by crnk-project.
the class OperationsExceptionTest method testUnknownErrorTriggerInternalError.
@Test
public void testUnknownErrorTriggerInternalError() {
operationsModule.addFilter(new OperationFilter() {
@Override
public List<OperationResponse> filter(OperationFilterContext context, OperationFilterChain chain) {
throw new IllegalStateException("test");
}
});
MovieEntity movie1 = newMovie("1");
MovieEntity movie2 = newMovie("2");
OperationsCall insertCall = operationsClient.createCall();
insertCall.add(HttpMethod.POST, movie1);
insertCall.add(HttpMethod.POST, movie2);
try {
insertCall.execute();
Assert.fail();
} catch (InternalServerErrorException e) {
// ok
}
}
use of io.crnk.operations.server.OperationFilter in project crnk-framework by crnk-project.
the class OperationsModuleTest method testRemoveFilter.
@Test
public void testRemoveFilter() {
OperationFilter filter = Mockito.mock(OperationFilter.class);
module.addFilter(filter);
Assert.assertEquals(1, module.getFilters().size());
module.removeFilter(filter);
Assert.assertEquals(0, module.getFilters().size());
}
Aggregations