本文整理汇总了Java中io.vertx.rx.java.RxHelper.toSubscriber方法的典型用法代码示例。如果您正苦于以下问题:Java RxHelper.toSubscriber方法的具体用法?Java RxHelper.toSubscriber怎么用?Java RxHelper.toSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.rx.java.RxHelper
的用法示例。
在下文中一共展示了RxHelper.toSubscriber方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSingleFutureSubscriptionSuccess
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testSingleFutureSubscriptionSuccess() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
SingleEmitter<String> emitter = subscribeToSingle(sub);
assertEquals(Collections.emptyList(), results);
emitter.onSuccess("the-value-1");
assertEquals(Collections.singletonList("the-value-1"), results);
emitter.onSuccess("the-value-2");
assertEquals(Collections.singletonList("the-value-1"), results);
}
示例2: testSingleFutureSubscriptionError
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testSingleFutureSubscriptionError() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
SingleEmitter<String> emitter = subscribeToSingle(sub);
assertEquals(Collections.emptyList(), results);
Throwable cause = new Throwable();
emitter.onError(cause);
assertEquals(Collections.singletonList(cause), results);
emitter.onSuccess("the-value");
assertEquals(Collections.singletonList(cause), results);
}
示例3: testObservableFutureSubscriptionCompletedWithNoItems
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithNoItems() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
Emitter<String> emitter = subscribe(sub);
assertEquals(Collections.emptyList(), results);
emitter.onCompleted();
assertEquals(Collections.singletonList(null), results);
emitter.onNext("the-value-1");
assertEquals(Collections.singletonList(null), results);
}
示例4: testObservableFutureSubscriptionCompletedWithItem
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithItem() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
Emitter<String> emitter = subscribe(sub);
assertEquals(Collections.emptyList(), results);
emitter.onNext("the-value-1");
assertEquals(Collections.singletonList("the-value-1"), results);
emitter.onCompleted();
emitter.onNext("the-value-1");
assertEquals(Collections.singletonList("the-value-1"), results);
}
示例5: testObservableFutureSubscriptionCompletedWithItems
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithItems() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
Emitter<String> emitter = subscribe(sub);
assertEquals(Collections.emptyList(), results);
emitter.onNext("the-value-1");
assertEquals(Collections.singletonList("the-value-1"), results);
emitter.onNext("the-value-2");
assertEquals(Collections.singletonList("the-value-1"), results);
}
示例6: testObservableFutureSubscriptionError
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionError() {
List<Object> results = new ArrayList<>();
Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
Emitter<String> emitter = subscribe(sub);
assertEquals(Collections.emptyList(), results);
Throwable cause = new Throwable();
emitter.onError(cause);
assertEquals(Collections.singletonList(cause), results);
emitter.onNext("the-value");
assertEquals(Collections.singletonList(cause), results);
}
示例7: toSubscriber
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public static <T> Subscriber<T> toSubscriber(Handler<AsyncResult<T>> handler) {
return RxHelper.toSubscriber(handler);
}