本文整理了Java中io.reactivex.internal.functions.Functions.emptyConsumer()
方法的一些代码示例,展示了Functions.emptyConsumer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.emptyConsumer()
方法的具体详情如下:
包路径:io.reactivex.internal.functions.Functions
类名称:Functions
方法名:emptyConsumer
[英]Returns an empty consumer that does nothing.
[中]返回不执行任何操作的空使用者。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> createPublisher(long elements) {
return
Flowable.range(0, (int)elements).doOnNext(Functions.emptyConsumer())
;
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void usingResourceSupplierNull() {
Single.using(null, new Function<Object, Single<Integer>>() {
@Override
public Single<Integer> apply(Object d) {
return just1;
}
}, Functions.emptyConsumer());
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void usingSingleSupplierNull() {
Single.using(new Callable<Object>() {
@Override
public Object call() {
return 1;
}
}, null, Functions.emptyConsumer());
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void usingResourceSupplierNull() {
Flowable.using(null, new Function<Object, Publisher<Integer>>() {
@Override
public Publisher<Integer> apply(Object d) {
return just1;
}
}, Functions.emptyConsumer());
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> createPublisher(long elements) {
return
Flowable.range(0, (int)elements).doAfterNext(Functions.emptyConsumer())
;
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void customOnErrorShouldReportCustomOnError() {
MaybeCallbackObserver<Integer> o = new MaybeCallbackObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION);
assertTrue(o.hasCustomOnError());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void customOnErrorShouldReportCustomOnError() {
BoundedSubscriber<Integer> subscriber = new BoundedSubscriber<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION,
Functions.<Subscription>boundedConsumer(128), 128);
assertTrue(subscriber.hasCustomOnError());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Object> apply(Flowable<Object> f)
throws Exception {
return Flowable.using(Functions.justCallable(1), Functions.justFunction(f), Functions.emptyConsumer());
}
});
代码示例来源:origin: ReactiveX/RxJava
@Test
public void onErrorMissingShouldReportNoCustomOnError() {
MaybeCallbackObserver<Integer> o = new MaybeCallbackObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION);
assertFalse(o.hasCustomOnError());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void flowableBoundedBlockingSubscribe1() {
Flowable.error(new TestException())
.blockingSubscribe(Functions.emptyConsumer(), 128);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void subscriberCount() {
ParallelFlowableTest.checkSubscriberCount(Flowable.range(1, 5).parallel()
.doOnNext(Functions.emptyConsumer()));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void doOnNextWrongParallelism() {
TestHelper.checkInvalidParallelSubscribers(
Flowable.just(1).parallel(1)
.doOnNext(Functions.emptyConsumer(), ParallelFailureHandling.ERROR)
);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void doubleOnSubscribe() {
TestHelper.doubleOnSubscribe(new DisposableLambdaObserver<Integer>(
new TestObserver<Integer>(), Functions.emptyConsumer(), Functions.EMPTY_ACTION
));
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Long> createPublisher(long elements) {
return
Flowable.using(Functions.justCallable(1),
Functions.justFunction(Flowable.fromIterable(iterate(elements))),
Functions.emptyConsumer()
)
;
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void dispose() {
MaybeCallbackObserver<Object> mo = new MaybeCallbackObserver<Object>(Functions.emptyConsumer(), Functions.emptyConsumer(), Functions.EMPTY_ACTION);
Disposable d = Disposables.empty();
mo.onSubscribe(d);
assertFalse(mo.isDisposed());
mo.dispose();
assertTrue(mo.isDisposed());
assertTrue(d.isDisposed());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void sourceSupplierReturnsNull() {
Flowable.using(Functions.justCallable(1),
Functions.justFunction((Publisher<Object>)null),
Functions.emptyConsumer())
.test()
.assertFailureAndMessage(NullPointerException.class, "The sourceSupplier returned a null Publisher")
;
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void doOnNextWrongParallelismConditional() {
TestHelper.checkInvalidParallelSubscribers(
Flowable.just(1).parallel(1)
.doOnNext(Functions.emptyConsumer(), ParallelFailureHandling.ERROR)
.filter(Functions.alwaysTrue())
);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normalNonEager() {
Single.using(Functions.justCallable(1), Functions.justFunction(Single.just(1)), Functions.emptyConsumer(), false)
.test()
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void errorEager() {
Single.using(Functions.justCallable(1), Functions.justFunction(Single.error(new TestException())), Functions.emptyConsumer())
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test(timeout = 5000)
public void subscribeTwoCallbacksDispose() {
PublishProcessor<Integer> pp = PublishProcessor.create();
Disposable d = pp.ignoreElements().subscribe(Functions.EMPTY_ACTION, Functions.emptyConsumer());
assertFalse(d.isDisposed());
assertTrue(pp.hasSubscribers());
d.dispose();
assertTrue(d.isDisposed());
assertFalse(pp.hasSubscribers());
}
内容来源于网络,如有侵权,请联系作者删除!