/** * Occasionally zip may be invoked with 0 observables. Test that we don't block indefinitely * instead of immediately invoking zip with 0 argument. * * <p>We now expect an NoSuchElementException since last() requires at least one value and nothing * will be emitted. */ @Test(expected = NoSuchElementException.class) public void nonBlockingObservable() { final Object invoked = new Object(); Collection<Observable<Object>> observables = Collections.emptyList(); Observable<Object> result = Observable.zip( observables, args -> { System.out.println("received: " + args); assertEquals("No argument should have been passed", 0, args.length); return invoked; }); assertSame(invoked, result.toBlocking().last()); }