DATACMNS-836 - Provide wrapper conversion, ReactiveWrappers and RxJava 2 type conversion.
This commit is contained in:
committed by
Oliver Gierke
parent
aa32c3d53d
commit
474c9981da
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.repository.query;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import rx.Completable;
|
||||
import rx.Observable;
|
||||
import rx.Single;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ReactiveWrapperConverters}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class ReactiveWrapperConvertersUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldSupportReactorTypes() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.supports(Mono.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Flux.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Publisher.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Object.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldSupportRxJavaTypes() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.supports(Single.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Observable.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Completable.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void isSingleLikeShouldReportCorrectSingleTypes() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.isSingleLike(Mono.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.isSingleLike(Flux.class)).isFalse();
|
||||
assertThat(ReactiveWrapperConverters.isSingleLike(Single.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.isSingleLike(Observable.class)).isFalse();
|
||||
assertThat(ReactiveWrapperConverters.isSingleLike(Publisher.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void isCollectionLikeShouldReportCorrectCollectionTypes() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.isCollectionLike(Mono.class)).isFalse();
|
||||
assertThat(ReactiveWrapperConverters.isCollectionLike(Flux.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.isCollectionLike(Single.class)).isFalse();
|
||||
assertThat(ReactiveWrapperConverters.isCollectionLike(Observable.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.isCollectionLike(Publisher.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldCastMonoToMono() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isSameAs(foo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertMonoToSingle() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Single.class)).isInstanceOf(Single.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertMonoToFlux() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Flux.class)).isInstanceOf(Flux.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapMono() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
Mono<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.block()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapFlux() {
|
||||
|
||||
Flux<String> foo = Flux.just("foo");
|
||||
Flux<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.next().block()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapSingle() {
|
||||
|
||||
Single<String> foo = Single.just("foo");
|
||||
Single<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.toBlocking().value()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapObservable() {
|
||||
|
||||
Observable<String> foo = Observable.just("foo");
|
||||
Observable<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.toBlocking().first()).isEqualTo(1L);
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,11 @@ public class QueryExecutionConvertersUnitTests {
|
||||
assertThat(QueryExecutionConverters.supports(Single.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(Completable.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(Observable.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(io.reactivex.Single.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(io.reactivex.Maybe.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(io.reactivex.Completable.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(io.reactivex.Flowable.class), is(true));
|
||||
assertThat(QueryExecutionConverters.supports(io.reactivex.Observable.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,6 +116,11 @@ public class QueryExecutionConvertersUnitTests {
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(Single.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(Completable.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(Observable.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(io.reactivex.Single.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(io.reactivex.Maybe.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(io.reactivex.Completable.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(io.reactivex.Flowable.class), is(false));
|
||||
assertThat(QueryExecutionConverters.supportsUnwrapping(io.reactivex.Observable.class), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.repository.util;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import org.springframework.data.repository.util.ReactiveWrapperConverters;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import rx.Completable;
|
||||
import rx.Observable;
|
||||
import rx.Single;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ReactiveWrapperConverters}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class ReactiveWrapperConvertersUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldSupportReactorTypes() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.supports(Mono.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Flux.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Publisher.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Object.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldSupportRxJava1Types() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.supports(Single.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Observable.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(Completable.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldSupportRxJava2Types() {
|
||||
|
||||
assertThat(ReactiveWrapperConverters.supports(io.reactivex.Single.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(io.reactivex.Maybe.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(io.reactivex.Observable.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(io.reactivex.Flowable.class)).isTrue();
|
||||
assertThat(ReactiveWrapperConverters.supports(io.reactivex.Completable.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldCastMonoToMono() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isSameAs(foo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertMonoToRxJava1Single() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Single.class)).isInstanceOf(Single.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertMonoToRxJava2Single() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, io.reactivex.Single.class))
|
||||
.isInstanceOf(io.reactivex.Single.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2SingleToMono() {
|
||||
|
||||
io.reactivex.Single<String> foo = io.reactivex.Single.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isInstanceOf(Mono.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2SingleToPublisher() {
|
||||
|
||||
io.reactivex.Single<String> foo = io.reactivex.Single.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Publisher.class)).isInstanceOf(Publisher.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2MaybeToMono() {
|
||||
|
||||
io.reactivex.Maybe<String> foo = io.reactivex.Maybe.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isInstanceOf(Mono.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2MaybeToFlux() {
|
||||
|
||||
io.reactivex.Maybe<String> foo = io.reactivex.Maybe.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Flux.class)).isInstanceOf(Flux.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2MaybeToPublisher() {
|
||||
|
||||
io.reactivex.Maybe<String> foo = io.reactivex.Maybe.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Publisher.class)).isInstanceOf(Publisher.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2FlowableToMono() {
|
||||
|
||||
io.reactivex.Flowable<String> foo = io.reactivex.Flowable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isInstanceOf(Mono.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2FlowableToFlux() {
|
||||
|
||||
io.reactivex.Flowable<String> foo = io.reactivex.Flowable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Flux.class)).isInstanceOf(Flux.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldCastRxJava2FlowableToPublisher() {
|
||||
|
||||
io.reactivex.Flowable<String> foo = io.reactivex.Flowable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Publisher.class)).isSameAs(foo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2ObservableToMono() {
|
||||
|
||||
io.reactivex.Observable<String> foo = io.reactivex.Observable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Mono.class)).isInstanceOf(Mono.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2ObservableToFlux() {
|
||||
|
||||
io.reactivex.Observable<String> foo = io.reactivex.Observable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Flux.class)).isInstanceOf(Flux.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertRxJava2ObservableToPublisher() {
|
||||
|
||||
io.reactivex.Observable<String> foo = io.reactivex.Observable.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Publisher.class)).isInstanceOf(Publisher.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void toWrapperShouldConvertMonoToFlux() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
assertThat(ReactiveWrapperConverters.toWrapper(foo, Flux.class)).isInstanceOf(Flux.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapMono() {
|
||||
|
||||
Mono<String> foo = Mono.just("foo");
|
||||
Mono<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.block()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapFlux() {
|
||||
|
||||
Flux<String> foo = Flux.just("foo");
|
||||
Flux<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.next().block()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava1Single() {
|
||||
|
||||
Single<String> foo = Single.just("foo");
|
||||
Single<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.toBlocking().value()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava1Observable() {
|
||||
|
||||
Observable<String> foo = Observable.just("foo");
|
||||
Observable<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.toBlocking().first()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava2Single() {
|
||||
|
||||
io.reactivex.Single<String> foo = io.reactivex.Single.just("foo");
|
||||
io.reactivex.Single<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.blockingGet()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava2Maybe() {
|
||||
|
||||
io.reactivex.Maybe<String> foo = io.reactivex.Maybe.just("foo");
|
||||
io.reactivex.Maybe<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.toSingle().blockingGet()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava2Observable() {
|
||||
|
||||
io.reactivex.Observable<String> foo = io.reactivex.Observable.just("foo");
|
||||
io.reactivex.Observable<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.blockingFirst()).isEqualTo(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void shouldMapRxJava2Flowable() {
|
||||
|
||||
io.reactivex.Flowable<String> foo = io.reactivex.Flowable.just("foo");
|
||||
io.reactivex.Flowable<Long> map = ReactiveWrapperConverters.map(foo, source -> 1L);
|
||||
assertThat(map.blockingFirst()).isEqualTo(1L);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.repository.util;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.Flowable;
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import rx.Observable;
|
||||
import rx.Single;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ReactiveWrappers}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class ReactiveWrappersUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void isSingleLikeShouldReportCorrectNoTypes() {
|
||||
|
||||
assertThat(ReactiveWrappers.isNoValueType(Mono.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Flux.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Single.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Completable.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Observable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Publisher.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isNoValueType(io.reactivex.Single.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(io.reactivex.Maybe.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(Flowable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isNoValueType(io.reactivex.Observable.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void isSingleLikeShouldReportCorrectSingleTypes() {
|
||||
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Mono.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Flux.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Single.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Completable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Observable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Publisher.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(io.reactivex.Single.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(io.reactivex.Completable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(io.reactivex.Maybe.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Flowable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(io.reactivex.Observable.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-836
|
||||
*/
|
||||
@Test
|
||||
public void isCollectionLikeShouldReportCorrectCollectionTypes() {
|
||||
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Mono.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Flux.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Single.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(Completable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Observable.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Publisher.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(io.reactivex.Single.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isSingleValueType(io.reactivex.Completable.class)).isFalse();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(Flowable.class)).isTrue();
|
||||
assertThat(ReactiveWrappers.isMultiValueType(io.reactivex.Observable.class)).isTrue();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user