@Test
public void testAmb2() {

    IOException needHappenedException = new IOException(
            "fake exception");
    Observable<String> observable1 = createObservable(new String[] {},
            2000, new IOException("fake exception"));
    Observable<String> observable2 = createObservable(new String[] {
            "2", "22", "222", "2222" }, 1000, needHappenedException);
    Observable<String> observable3 = createObservable(new String[] {},
            3000, new IOException("fake exception"));
    Observable<String> o = Observable.create(amb(observable1,
            observable2, observable3));
    @SuppressWarnings("unchecked")
    Observer<String> observer = (Observer<String>) mock(Observer.class);
    o.subscribe(observer);
    scheduler.advanceTimeBy(100000, TimeUnit.MILLISECONDS);
    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onNext("2");
    inOrder.verify(observer, times(1)).onNext("22");
    inOrder.verify(observer, times(1)).onNext("222");
    inOrder.verify(observer, times(1)).onNext("2222");
    inOrder.verify(observer, times(1)).onError(needHappenedException);
    inOrder.verifyNoMoreInteractions();
}