Polishing

This commit is contained in:
Juergen Hoeller
2023-08-06 14:25:39 +02:00
parent 4a81814dbb
commit 6e5af9dccb
13 changed files with 125 additions and 131 deletions

View File

@@ -20,6 +20,7 @@ import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Flow;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
@@ -27,6 +28,7 @@ import kotlinx.coroutines.Deferred;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.adapter.JdkFlowAdapter;
import reactor.core.CoreSubscriber;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -112,6 +114,16 @@ class ReactiveAdapterRegistryTests {
assertThat(((Mono<Integer>) target).block(ONE_SECOND)).isEqualTo(Integer.valueOf(1));
}
@Test
void toFlowPublisher() {
List<Integer> sequence = Arrays.asList(1, 2, 3);
Publisher<Integer> source = io.reactivex.rxjava3.core.Flowable.fromIterable(sequence);
Object target = getAdapter(Flow.Publisher.class).fromPublisher(source);
assertThat(target).isInstanceOf(Flow.Publisher.class);
assertThat(JdkFlowAdapter.flowPublisherToFlux((Flow.Publisher<Integer>) target)
.collectList().block(ONE_SECOND)).isEqualTo(sequence);
}
@Test
void toCompletableFuture() throws Exception {
Publisher<Integer> source = Flux.fromArray(new Integer[] {1, 2, 3});