use of io.reactivex.Flowable in project retrofit by square.
the class RxJava2CallAdapterFactoryTest method rawResponseTypeThrows.
@Test
public void rawResponseTypeThrows() {
Type observableType = new TypeToken<Observable<Response>>() {
}.getType();
try {
factory.get(observableType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
}
Type singleType = new TypeToken<Single<Response>>() {
}.getType();
try {
factory.get(singleType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
}
Type maybeType = new TypeToken<Maybe<Response>>() {
}.getType();
try {
factory.get(maybeType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
}
Type flowableType = new TypeToken<Flowable<Response>>() {
}.getType();
try {
factory.get(flowableType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
}
}
use of io.reactivex.Flowable in project retrofit by square.
the class RxJava2CallAdapterFactoryTest method rawResultTypeThrows.
@Test
public void rawResultTypeThrows() {
Type observableType = new TypeToken<Observable<Result>>() {
}.getType();
try {
factory.get(observableType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
}
Type singleType = new TypeToken<Single<Result>>() {
}.getType();
try {
factory.get(singleType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
}
Type maybeType = new TypeToken<Maybe<Result>>() {
}.getType();
try {
factory.get(maybeType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
}
Type flowableType = new TypeToken<Flowable<Result>>() {
}.getType();
try {
factory.get(flowableType, NO_ANNOTATIONS, retrofit);
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Result must be parameterized as Result<Foo> or Result<? extends Foo>");
}
}
use of io.reactivex.Flowable in project spring-framework by spring-projects.
the class HttpEntityArgumentResolverTests method emptyBodyWithFlowable.
@Test
public void emptyBodyWithFlowable() throws Exception {
ResolvableType type = httpEntityType(Flowable.class, String.class);
HttpEntity<Flowable<String>> entity = resolveValueWithEmptyBody(type);
StepVerifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
}
use of io.reactivex.Flowable in project RxJava by ReactiveX.
the class FlowableMergeDelayErrorTest method mergeMany.
@SuppressWarnings("unchecked")
@Test
@Ignore("No 2-9 parameter mergeDelayError() overloads")
public void mergeMany() throws Exception {
for (int i = 2; i < 10; i++) {
Class<?>[] clazz = new Class[i];
Arrays.fill(clazz, Flowable.class);
Flowable<Integer>[] obs = new Flowable[i];
Arrays.fill(obs, Flowable.just(1));
Integer[] expected = new Integer[i];
Arrays.fill(expected, 1);
Method m = Flowable.class.getMethod("mergeDelayError", clazz);
TestSubscriber<Integer> ts = TestSubscriber.create();
((Flowable<Integer>) m.invoke(null, (Object[]) obs)).subscribe(ts);
ts.assertValues(expected);
ts.assertNoErrors();
ts.assertComplete();
}
}
use of io.reactivex.Flowable in project RxJava by ReactiveX.
the class SchedulerWhenTest method testRaceConditions.
@Test(timeout = 1000)
public void testRaceConditions() {
Scheduler comp = Schedulers.computation();
Scheduler limited = comp.when(new Function<Flowable<Flowable<Completable>>, Completable>() {
@Override
public Completable apply(Flowable<Flowable<Completable>> t) {
return Completable.merge(Flowable.merge(t, 10));
}
});
merge(just(just(1).subscribeOn(limited).observeOn(comp)).repeat(1000)).blockingSubscribe();
}
Aggregations