ZipTests.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:lakeside-java 作者:
/**
 * Occasionally zip may be invoked with 0 observables. Test that we don't block indefinitely instead
 * of immediately invoking zip with 0 argument.
 * 
 * We now expect an IllegalArgumentException since last() requires at least one value and nothing will be emitted.
 */
@Test(expected = IllegalArgumentException.class)
public void nonBlockingObservable() {

    final Object invoked = new Object();

    Collection<Observable<Object>> observables = Collections.emptyList();

    Observable<Object> result = Observable.zip(observables, new FuncN<Object>() {
        @Override
        public Object call(final Object... args) {
            System.out.println("received: " + args);
            assertEquals("No argument should have been passed", 0, args.length);
            return invoked;
        }
    });

    assertSame(invoked, result.toBlockingObservable().last());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号