/** * Signal the events of this or the other Solo whichever * signals first. * @param other the other Solo * @return the new Solo instance */ @SuppressWarnings("unchecked") public final Solo<T> ambWith(Solo<? extends T> other) { return ambArray(this, other); }
/** * Signal the events of this or the other Solo whichever * signals first. * @param other the other Solo * @return the new Solo instance */ @SuppressWarnings("unchecked") public final Solo<T> ambWith(Solo<? extends T> other) { return ambArray(this, other); }
@SuppressWarnings("unchecked") @Test public void ambArray1Error() { SoloProcessor<Integer> sp1 = SoloProcessor.create(); SoloProcessor<Integer> sp2 = SoloProcessor.create(); TestSubscriber<Integer> ts = Solo.ambArray(sp1, sp2) .test(); assertTrue(sp1.hasSubscribers()); assertTrue(sp2.hasSubscribers()); ts.assertEmpty(); sp1.onError(new IOException()); ts.assertFailure(IOException.class); assertFalse(sp1.hasSubscribers()); assertFalse(sp2.hasSubscribers()); }
@SuppressWarnings("unchecked") @Test public void ambArray2Error() { SoloProcessor<Integer> sp1 = SoloProcessor.create(); SoloProcessor<Integer> sp2 = SoloProcessor.create(); TestSubscriber<Integer> ts = Solo.ambArray(sp1, sp2) .test(); assertTrue(sp1.hasSubscribers()); assertTrue(sp2.hasSubscribers()); ts.assertEmpty(); sp2.onError(new IOException()); ts.assertFailure(IOException.class); assertFalse(sp1.hasSubscribers()); assertFalse(sp2.hasSubscribers()); }
@SuppressWarnings("unchecked") @Test public void ambArray2() { SoloProcessor<Integer> sp1 = SoloProcessor.create(); SoloProcessor<Integer> sp2 = SoloProcessor.create(); TestSubscriber<Integer> ts = Solo.ambArray(sp1, sp2) .test(); assertTrue(sp1.hasSubscribers()); assertTrue(sp2.hasSubscribers()); ts.assertEmpty(); sp2.onNext(2); ts.assertResult(2); assertFalse(sp1.hasSubscribers()); assertFalse(sp2.hasSubscribers()); }
@SuppressWarnings("unchecked") @Test public void ambArray1() { SoloProcessor<Integer> sp1 = SoloProcessor.create(); SoloProcessor<Integer> sp2 = SoloProcessor.create(); TestSubscriber<Integer> ts = Solo.ambArray(sp1, sp2) .test(); assertTrue(sp1.hasSubscribers()); assertTrue(sp2.hasSubscribers()); ts.assertEmpty(); sp1.onNext(1); ts.assertResult(1); assertFalse(sp1.hasSubscribers()); assertFalse(sp2.hasSubscribers()); }