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

    Flowable.range(1, 5)
    .parallel()
    .to(new Function<ParallelFlowable<Integer>, Flowable<Integer>>() {
        @Override
        public Flowable<Integer> apply(ParallelFlowable<Integer> pf) throws Exception {
            throw new TestException();
        }
    });
}