@@ -0,0 +1,1214 @@
+package com.github.davidmoten.rx.testing;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport org.junit.Test;%0A%0Aimport rx.Observable;%0Aimport rx.Subscriber;%0Aimport rx.schedulers.Schedulers;%0A%0Apublic class MergeTest %7B%0A%0A%09@Test%0A%09public void testMerge() throws InterruptedException %7B%0A%09%09// while (true) %7B%0A%09%09final CountDownLatch latch = new CountDownLatch(1);%0A%09%09final List%3CInteger%3E list = new ArrayList%3CInteger%3E();%0A%09%09Subscriber%3CInteger%3E sub = new Subscriber%3CInteger%3E() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void onStart() %7B%0A%09%09%09%09request(1);%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public void onCompleted() %7B%0A%09%09%09%09latch.countDown();%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public void onError(Throwable e) %7B%0A%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public void onNext(Integer t) %7B%0A%09%09%09%09list.add(t);%0A%09%09%09%09request(0);%0A%09%09%09%09request(1);%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09Observable.%3CInteger%3E empty()%0A%09%09%09%09.mergeWith(Observable.from(Arrays.asList(1, 2, 3)).subscribeOn(Schedulers.computation()))%0A%09%09%09%09.subscribe(sub);%0A%09%09if (!latch.await(1, TimeUnit.SECONDS))%0A%09%09%09throw new RuntimeException(%22timed out%22);%0A%09%09assertEquals(Arrays.asList(1, 2, 3), list);%0A%09%09// %7D%0A%09%7D%0A%0A%7D%0A

add failing test