// Path: rxjava2-server/src/main/java/net/winterly/rxjersey/server/rxjava2/CompletableRequestInterceptor.java
// public interface CompletableRequestInterceptor extends RxRequestInterceptor<Completable> {
// 
// }


import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.Single;
import net.winterly.rxjersey.server.rxjava2.CompletableRequestInterceptor;
import org.glassfish.jersey.internal.inject.AbstractBinder;
import org.junit.Test;
import javax.inject.Singleton;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.GET;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.Path;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;
import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
        target("interceptors").path("error")
                .request()
                .header("throw", true)
                .get(String.class);
    }

    @Test(expected = BadRequestException.class)
    public void shouldHandleInterceptorError() {
        target("interceptors").path("error")
                .request()
                .header("error", true)
                .get(String.class);
    }

    @Path("/interceptors")
    public static class EchoResource {

        @GET
        @Path("echo")
        public Observable<String> echo(@Context ContainerRequestContext request) {
            return Observable.just(request.getProperty("message").toString());
        }

        @GET
        @Path("error")
        public Observable<String> error() {
            return Observable.just(null);
        }
    }

// Path: rxjava2-server/src/main/java/net/winterly/rxjersey/server/rxjava2/CompletableRequestInterceptor.java
// public interface CompletableRequestInterceptor extends RxRequestInterceptor<Completable> {
// 
// }


// Path: rxjava2-server/src/test/java/InterceptorsTest.java
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.Single;
import net.winterly.rxjersey.server.rxjava2.CompletableRequestInterceptor;
import org.glassfish.jersey.internal.inject.AbstractBinder;
import org.junit.Test;
import javax.inject.Singleton;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.GET;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.Path;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;
import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;

        target("interceptors").path("error")
                .request()
                .header("throw", true)
                .get(String.class);
    }

    @Test(expected = BadRequestException.class)
    public void shouldHandleInterceptorError() {
        target("interceptors").path("error")
                .request()
                .header("error", true)
                .get(String.class);
    }

    @Path("/interceptors")
    public static class EchoResource {

        @GET
        @Path("echo")
        public Observable<String> echo(@Context ContainerRequestContext request) {
            return Observable.just(request.getProperty("message").toString());
        }

        @GET
        @Path("error")
        public Observable<String> error() {
            return Observable.just(null);
        }
    }

    public static class Interceptor implements CompletableRequestInterceptor {