package com.github.davidmoten.rx;

import static java.util.Arrays.asList;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import rx.Observable;
import rx.functions.Func1;

import com.github.davidmoten.rx.testing.TestingHelper;

public class TestingHelperMergeTest extends TestCase {

    private static final Func1<Observable<String>, Observable<String>> onBufferBackpressure = new Func1<Observable<String>, Observable<String>>() {
        @Override
        public Observable<String> call(Observable<String> o) {
            return o.mergeWith(Observable.from(asList("x", "y", "z")));
        }
    };

    public static TestSuite suite() {

        return TestingHelper.function(onBufferBackpressure)
                // test empty
                .name("testEmpty").fromEmpty().expect("x", "y", "z")
                // test non-empty count
                .name("testTwo").from("a", "b").expectAnyOrder("x", "y", "z", "a", "b")
                // test single input
                .name("testOne").from("a").expectAnyOrder("x", "y", "z", "a")
                // unsub before completion
                .name("testSomeUnsubscribeAfterOne").from("a", "b").unsubscribeAfter(1)
                .expectSize(1)
                // get test suites
                .testSuite(TestingHelperMergeTest.class);
    }

    public void testDummy() {
        // just here to fool eclipse
    }
}

@@ -330,38 +330,39 @@
 unc1%3CObservable%3C
-String
+Integer
 %3E, Observable%3CSt
@@ -363,36 +363,22 @@
 ble%3C
-String%3E%3E onBufferBackpressur
+Integer%3E%3E merg
 e = 
@@ -398,22 +398,23 @@
 ervable%3C
-String
+Integer
 %3E, Obser
@@ -419,22 +419,23 @@
 ervable%3C
-String
+Integer
 %3E%3E() %7B%0A 
@@ -477,22 +477,23 @@
 ervable%3C
-String
+Integer
 %3E call(O
@@ -506,14 +506,15 @@
 ble%3C
-String
+Integer
 %3E o)
@@ -570,29 +570,23 @@
 (asList(
-%22x%22, %22y%22, %22z%22
+7, 8, 9
 )));%0A   
@@ -681,38 +681,15 @@
 ion(
-onBufferBackpressure)%0A        
+merge)%0A
     
@@ -760,29 +760,23 @@
 .expect(
-%22x%22, %22y%22, %22z%22
+7, 8, 9
 )%0A      
@@ -847,24 +847,20 @@
 %22).from(
-%22a%22, %22b%22
+1, 2
 ).expect
@@ -872,31 +872,21 @@
 der(
-%22x%22, %22y%22, %22z%22, %22a%22, %22b%22
+1, 7, 8, 9, 2
 )%0A  
@@ -958,19 +958,17 @@
 %22).from(
-%22a%22
+1
 ).expect
@@ -980,26 +980,18 @@
 der(
-%22x%22, %22y%22, %22z%22, %22a%22
+7, 1, 8, 9
 )%0A  
@@ -1093,16 +1093,12 @@
 rom(
-%22a%22, %22b%22
+1, 2
 ).un
@@ -1114,33 +1114,16 @@
 After(1)
-%0A                
 .expectS

change test to work on Observable<Integer> as simplification