Search in sources :

Example 1 with OperationFilterChain

use of io.crnk.operations.server.OperationFilterChain 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
    }
}
Also used : MovieEntity(io.crnk.operations.model.MovieEntity) OperationFilterContext(io.crnk.operations.server.OperationFilterContext) OperationFilter(io.crnk.operations.server.OperationFilter) OperationFilterChain(io.crnk.operations.server.OperationFilterChain) InternalServerErrorException(io.crnk.core.exception.InternalServerErrorException) List(java.util.List) OperationsCall(io.crnk.operations.client.OperationsCall) Test(org.junit.Test)

Aggregations

InternalServerErrorException (io.crnk.core.exception.InternalServerErrorException)1 OperationsCall (io.crnk.operations.client.OperationsCall)1 MovieEntity (io.crnk.operations.model.MovieEntity)1 OperationFilter (io.crnk.operations.server.OperationFilter)1 OperationFilterChain (io.crnk.operations.server.OperationFilterChain)1 OperationFilterContext (io.crnk.operations.server.OperationFilterContext)1 List (java.util.List)1 Test (org.junit.Test)1