@Test(expected = TestException.class)
public void testUsingWithResourceFactoryError() {

    Func0<Subscription> resourceFactory = new Func0<Subscription>() {
        @Override
        public Subscription call() {
            throw new TestException();
        }
    };
    Func1<Subscription, Observable<Integer>> observableFactory = new Func1<Subscription, Observable<Integer>>() {
        @Override
        public Observable<Integer> call(Subscription subscription) {
            return Observable.empty();
        }
    };
    Observable.create(using(resourceFactory, observableFactory))
            .toBlockingObservable().last();
}