@Test
public void testToFutureWithException() {

    Observable<String> obs = Observable.create(new OnSubscribe<String>() {
        @Override
        public void call(Subscriber<? super String> observer) {
            observer.onNext("one");
            observer.onError(new TestException());
        }
    });
    Future<String> f = toFuture(obs);
    try {
        f.get();
        fail("expected exception");
    } catch (Throwable e) {
        assertEquals(TestException.class, e.getCause().getClass());
    }
}