@Test
public void testUnsubscribeFromSomeDuplicateArgsDoesNotRemoveFromBatch() throws Exception {

    final int NUM = 10;
    List<Observable<Integer>> observables = new ArrayList<Observable<Integer>>();
    for (int i = 0; i < NUM; i++) {
        MyCollapser c = new MyCollapser("5", true);
        observables.add(c.toObservable());
    }
    List<TestSubscriber<Integer>> subscribers = new ArrayList<TestSubscriber<Integer>>();
    List<Subscription> subscriptions = new ArrayList<Subscription>();
    for (final Observable<Integer> o: observables) {
        final TestSubscriber<Integer> sub = new TestSubscriber<Integer>();
        subscribers.add(sub);
        Subscription s = o.subscribe(sub);
        subscriptions.add(s);
    }
    //unsubscribe from all but 1
    for (int i = 0; i < NUM - 1; i++) {
        Subscription s = subscriptions.get(i);
        s.unsubscribe();
    }
    Thread.sleep(100);
    //all subscribers with an active subscription should receive the same value
    for (TestSubscriber<Integer> sub: subscribers) {
        if (!sub.isUnsubscribed()) {
            sub.awaitTerminalEvent(1000, TimeUnit.MILLISECONDS);
            System.out.println("Subscriber received : " + sub.getOnNextEvents());
            sub.assertNoErrors();
            sub.assertValues(5);
        } else {
            System.out.println("Subscriber is unsubscribed");
        }
    }
}