Esempio n. 1
0
 public static <T0, T1, R> Func1<Observer<R>, Subscription> zip(
     Observable<T0> w0, Observable<T1> w1, Func2<T0, T1, R> zipFunction) {
   Aggregator<R> a = new Aggregator<R>(Functions.fromFunc(zipFunction));
   a.addObserver(new ZipObserver<R, T0>(a, w0));
   a.addObserver(new ZipObserver<R, T1>(a, w1));
   return a;
 }
Esempio n. 2
0
    @SuppressWarnings("unchecked")
    @Test
    public void testCollectionSizeDifferentThanFunction() {
      FuncN<String> zipr = Functions.from(getConcatStringIntegerIntArrayZipr());

      /* define a Observer to receive aggregated events */
      Observer<String> aObserver = mock(Observer.class);

      Collection ws = java.util.Collections.singleton(Observable.from("one", "two"));
      Observable<String> w = Observable.create(zip(ws, zipr));
      w.subscribe(aObserver);

      verify(aObserver, times(1)).onError(any(Exception.class));
      verify(aObserver, never()).onCompleted();
      verify(aObserver, never()).onNext(any(String.class));
    }