Java Code Examples for reactor.test.StepVerifier#create()

The following examples show how to use reactor.test.StepVerifier#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerErrorIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void manyToOne() {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<HelloRequest> requestFlux = Flux.just(HelloRequest.getDefaultInstance());

    if (!expectFusion) {
        requestFlux = requestFlux.hide();
    }

    Mono<HelloResponse> resp = requestFlux.as(stub::sayHelloReqStream);

    StepVerifier.Step<HelloResponse> stepVerifier = StepVerifier.create(resp);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<HelloResponse>) stepVerifier).expectFusion();
    }

    stepVerifier
            .verifyErrorMatches(t -> t instanceof StatusRuntimeException && ((StatusRuntimeException)t).getStatus() == Status.INTERNAL);
}
 
Example 2
Source File: EndToEndIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void manyToOne() throws Exception {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<HelloRequest> req = Flux.just(
            HelloRequest.newBuilder().setName("a").build(),
            HelloRequest.newBuilder().setName("b").build(),
            HelloRequest.newBuilder().setName("c").build());

    if (!expectFusion) {
        req = req.hide();
    }

    Mono<HelloResponse> resp = req.as(stub::sayHelloReqStream);

    StepVerifier.Step<String> stepVerifier = StepVerifier.create(resp.map(HelloResponse::getMessage));

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<String>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext("Hello a and b and c")
            .verifyComplete();
}
 
Example 3
Source File: ClientThreadIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void oneToOne() {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Mono<HelloRequest> req = Mono.just(HelloRequest.newBuilder().setName("reactorjava").build());

    if (!expectFusion) {
        req = req.hide();
    }

    Mono<HelloResponse> resp = req.transform(stub::sayHello);

    AtomicReference<String> clientThreadName = new AtomicReference<>();

    StepVerifier.Step<String> stepVerifier = StepVerifier.create(
        resp
                .map(HelloResponse::getMessage)
                .doOnSuccess(x -> clientThreadName.set(Thread.currentThread().getName()))
    );

    stepVerifier
            .expectNext("Hello reactorjava")
            .verifyComplete();

    assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
    assertThat(service.serverThreadName.get()).isEqualTo("TheGrpcServer");
}
 
Example 4
Source File: Jackson2TokenizerTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
private void testTokenize(List<String> source, List<String> expected, boolean tokenizeArrayElements) {

		Flux<TokenBuffer> tokenBufferFlux = Jackson2Tokenizer.tokenize(
				Flux.fromIterable(source).map(this::stringBuffer),
				this.jsonFactory,
				tokenizeArrayElements);

		Flux<String> result = tokenBufferFlux
				.map(tokenBuffer -> {
					try {
						TreeNode root = this.objectMapper.readTree(tokenBuffer.asParser());
						return this.objectMapper.writeValueAsString(root);
					}
					catch (IOException ex) {
						throw new UncheckedIOException(ex);
					}
				});

		StepVerifier.FirstStep<String> builder = StepVerifier.create(result);
		expected.forEach(s -> builder.assertNext(new JSONAssertConsumer(s)));
		builder.verifyComplete();
	}
 
Example 5
Source File: Jackson2TokenizerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private void testTokenize(List<String> source, List<String> expected, boolean tokenizeArrayElements) {
	Flux<TokenBuffer> tokens = Jackson2Tokenizer.tokenize(
			Flux.fromIterable(source).map(this::stringBuffer),
			this.jsonFactory, this.objectMapper, tokenizeArrayElements);

	Flux<String> result = tokens
			.map(tokenBuffer -> {
				try {
					TreeNode root = this.objectMapper.readTree(tokenBuffer.asParser());
					return this.objectMapper.writeValueAsString(root);
				}
				catch (IOException ex) {
					throw new UncheckedIOException(ex);
				}
			});

	StepVerifier.FirstStep<String> builder = StepVerifier.create(result);
	expected.forEach(s -> builder.assertNext(new JSONAssertConsumer(s)));
	builder.verifyComplete();
}
 
Example 6
Source File: AbstractEncoderTestCase.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Test a standard {@link Encoder#encode encode} scenario.
 *
 * @param input the input to be provided to the encoder
 * @param inputType the input type
 * @param stepConsumer a consumer to {@linkplain StepVerifier verify} the output
 * @param mimeType the mime type to use for decoding. May be {@code null}.
 * @param hints the hints used for decoding. May be {@code null}.
 * @param <T> the output type
 */
@SuppressWarnings("unchecked")
protected <T> void testEncode(Publisher<? extends T> input, ResolvableType inputType,
		Consumer<StepVerifier.FirstStep<DataBuffer>> stepConsumer,
		@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {

	Flux<DataBuffer> result = encoder().encode(input, this.bufferFactory, inputType,
			mimeType, hints);
	StepVerifier.FirstStep<DataBuffer> step = StepVerifier.create(result);
	stepConsumer.accept(step);
}
 
Example 7
Source File: BaseOperatorTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
final StepVerifier.Step<O> inputHiddenOutputBackpressured(OperatorScenario<I, PI, O, PO> scenario) {
	int expected = scenario.receiverCount();
	int missing = expected - (expected / 2);

	long toRequest =
			expected == Integer.MAX_VALUE ? Long.MAX_VALUE : (expected - missing);

	StepVerifier.Step<O> step = StepVerifier.create(scenario.body()
	                                                        .apply(anySourceHidden(scenario)), toRequest);

	if (toRequest == Long.MAX_VALUE) {
		return scenario.applySteps(step);
	}
	return scenario.applySteps(expected - missing, step);
}
 
Example 8
Source File: ClientThreadIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void manyToMany() {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<HelloRequest> req = Flux.just(
            HelloRequest.newBuilder().setName("a").build(),
            HelloRequest.newBuilder().setName("b").build(),
            HelloRequest.newBuilder().setName("c").build(),
            HelloRequest.newBuilder().setName("d").build(),
            HelloRequest.newBuilder().setName("e").build());

    if (!expectFusion) {
        req = req.hide();
    }

    Flux<HelloResponse> resp = req.transform(stub::sayHelloBothStream);

    AtomicReference<String> clientThreadName = new AtomicReference<>();

    StepVerifier.Step<String> stepVerifier = StepVerifier.create(
        resp
            .map(HelloResponse::getMessage)
            .doOnNext(x -> clientThreadName.set(Thread.currentThread().getName()))
    );

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<String>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext("Hello a and b", "Hello c and d", "Hello e")
            .verifyComplete();

    assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
    assertThat(service.serverThreadName.get()).isEqualTo("TheGrpcServer");
}
 
Example 9
Source File: ServerErrorUpstreamCancellationIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void serverErrorSignalsUpstreamCancellationManyToOne() {
    serverRule.getServiceRegistry().addService(service);
    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    AtomicBoolean upstreamCancel = new AtomicBoolean(false);

    Flux<NumberProto.Number> requestFlux = Flux.range(0, Integer.MAX_VALUE)
                                               .map(this::protoNum)
                                               .doOnCancel(() -> upstreamCancel.set(true));

    if (!expectFusion) {
        requestFlux = requestFlux.hide();
    }

    Mono<NumberProto.Number> observer = requestFlux
                                            .as(stub::requestPressure)
                                            .doOnError(System.out::println)
                                            .doOnSuccess(i -> System.out.println(i.getNumber(0)));

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(observer);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .verifyError(StatusRuntimeException.class);

    assertThat(upstreamCancel.get()).isTrue();
}
 
Example 10
Source File: EndToEndIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void manyToMany() throws Exception {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<HelloRequest> req = Flux.just(
            HelloRequest.newBuilder().setName("a").build(),
            HelloRequest.newBuilder().setName("b").build(),
            HelloRequest.newBuilder().setName("c").build(),
            HelloRequest.newBuilder().setName("d").build(),
            HelloRequest.newBuilder().setName("e").build());

    if (!expectFusion) {
        req = req.hide();
    }

    Flux<HelloResponse> resp = req.transform(stub::sayHelloBothStream);



    StepVerifier.Step<String> stepVerifier = StepVerifier.create(resp.map(HelloResponse::getMessage));

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<String>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext("Hello a and b", "Hello c and d", "Hello e")
            .verifyComplete();
}
 
Example 11
Source File: BackpressureIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void bidiRequestBackpressure() {
    serverRule.getServiceRegistry().addService(service);

    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    Flux<NumberProto.Number> reactorRequest = Flux
            .fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator)
            .doOnNext(i -> System.out.println(i + " --> "))
            .doOnNext(i -> updateNumberOfWaits(lastValueTime, numberOfWaits))
            .map(BackpressureIntegrationTest::protoNum);

    if (!expectFusion) {
        reactorRequest = reactorRequest.hide();
    }

    Flux<NumberProto.Number> reactorResponse = reactorRequest.transform(stub::twoWayRequestPressure);

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(reactorResponse);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNextMatches(v -> v.getNumber(0) == NUMBER_OF_STREAM_ELEMENTS - 1)
            .expectComplete()
            .verify(Duration.ofSeconds(15));

    assertThat(numberOfWaits.get()).isGreaterThan(0L);
}
 
Example 12
Source File: FluxCreateTest.java    From reactor-core with Apache License 2.0 4 votes vote down vote up
private void testFluxCreateOnRequestSingleThread(OverflowStrategy overflowStrategy) {
	RequestTrackingTestQueue queue = new RequestTrackingTestQueue();
	Flux<Integer> created = Flux.create(pushPullSink -> {
		assertThat(pushPullSink instanceof SerializedSink).isTrue();
		SerializedSink<Integer> s = (SerializedSink<Integer>)pushPullSink;
		FluxSink<Integer> s1 = s.onRequest(n -> {
			if (queue.sink == null) {
				queue.initialize(s);
				assertThat(n).isEqualTo(10);
			}

			queue.generate(5);
			queue.onRequest((int) n);
			if (s.sink instanceof BufferAsyncSink) {
				assertThat(((BufferAsyncSink<?>)s.sink).queue.size()).isEqualTo(0);
			}
			queue.pushToSink();
		});
		assertThat(s1 instanceof SerializedSink).isTrue();
		assertThat(s.onDispose(() -> {}) instanceof SerializedSink).isTrue();
		assertThat(s.onCancel(() -> {}) instanceof SerializedSink).isTrue();
	}, overflowStrategy);

	Step<Integer> step = StepVerifier.create(created, 0);
	for (int i = 0; i < 100; i++) {
		step = step.thenRequest(10)
		           .expectNextCount(5)
		           .then(() -> queue.generate(15))
		           .thenRequest(5)
		           .thenRequest(5)
		           .expectNextCount(15)
		           .thenAwait()
		           .thenRequest(25)
		           .then(() -> queue.generate(5))
		           .then(() -> queue.generate(5))
		           .expectNextCount(25)
		           .thenAwait();
	}
	step.thenCancel().verify();
	assertThat(queue.queue.isEmpty()).isTrue();
}
 
Example 13
Source File: BaseOperatorTest.java    From reactor-core with Apache License 2.0 4 votes vote down vote up
final StepVerifier.Step<O> inputHidden(OperatorScenario<I, PI, O, PO> scenario) {
	return StepVerifier.create(scenario.body().apply(anySourceHidden(scenario)));
}
 
Example 14
Source File: CancellationPropagationIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void serverCanCancelClientStreamImplicitly() {
    serverRule.getServiceRegistry().addService(service);

    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    service.setExplicitCancel(false);

    AtomicBoolean requestWasCanceled = new AtomicBoolean(false);
    AtomicBoolean requestDidProduce = new AtomicBoolean(false);

    Flux<NumberProto.Number> request = Flux
            .fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator)
            .delayElements(Duration.ofMillis(SEQUENCE_DELAY_MILLIS))
            .map(CancellationPropagationIntegrationTest::protoNum)
            .doOnNext(x -> {
                requestDidProduce.set(true);
                System.out.println("Produced: " + x.getNumber(0));
            })
            .doOnCancel(() -> {
                requestWasCanceled.set(true);
                System.out.println("Client canceled");
            });

    if (!expectFusion) {
        request = request.hide();
    }

    Mono<NumberProto.Number> observer = request.as(stub::requestPressure)
            .doOnSuccess(number -> System.out.println(number.getNumber(0)))
            .doOnError(throwable -> System.out.println(throwable.getMessage()));

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(observer);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext(protoNum(9))
            .verifyComplete();

    await().atMost(org.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS).untilTrue(requestWasCanceled);

    assertThat(requestWasCanceled.get()).isTrue();
    assertThat(requestDidProduce.get()).isTrue();
}
 
Example 15
Source File: CancellationPropagationIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void serverCanCancelClientStreamExplicitly() {
    serverRule.getServiceRegistry().addService(service);

    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    service.setExplicitCancel(true);

    AtomicBoolean requestWasCanceled = new AtomicBoolean(false);
    AtomicBoolean requestDidProduce = new AtomicBoolean(false);

    Flux<NumberProto.Number> request = Flux
            .fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator)
            .delayElements(Duration.ofMillis(SEQUENCE_DELAY_MILLIS))
            .map(CancellationPropagationIntegrationTest::protoNum)
            .doOnNext(n -> {
                requestDidProduce.set(true);
                System.out.println("P: " + n.getNumber(0));
            })
            .doOnCancel(() -> {
                requestWasCanceled.set(true);
                System.out.println("Client canceled");
            });

    if (!expectFusion) {
        request = request.hide();
    }

    Mono<NumberProto.Number> observer = request.as(stub::requestPressure)
            .doOnSuccess(number -> System.out.println(number.getNumber(0)))
            .doOnError(throwable -> System.out.println(throwable.getMessage()));

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(observer);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext(protoNum(-1))
            .verifyComplete();

    await().atMost(org.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS).untilTrue(requestWasCanceled);

    assertThat(requestWasCanceled.get()).isTrue();
    assertThat(requestDidProduce.get()).isTrue();
}
 
Example 16
Source File: CancellationPropagationIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void serverCanCancelClientStreamImplicitlyBidi() {
    serverRule.getServiceRegistry().addService(service);

    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    service.setExplicitCancel(false);

    AtomicBoolean requestWasCanceled = new AtomicBoolean(false);
    AtomicBoolean requestDidProduce = new AtomicBoolean(false);

    Flux<NumberProto.Number> request = Flux
            .fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator)
            .delayElements(Duration.ofMillis(SEQUENCE_DELAY_MILLIS))
            .map(CancellationPropagationIntegrationTest::protoNum)
            .doOnNext(x -> {
                requestDidProduce.set(true);
                System.out.println("Produced: " + x.getNumber(0));
            })
            .doOnCancel(() -> {
                requestWasCanceled.set(true);
                System.out.println("Client canceled");
            });

    if (!expectFusion) {
        request = request.hide();
    }

    Flux<NumberProto.Number> observer = request.transform(stub::twoWayPressure)
            .doOnNext(number -> System.out.println(number.getNumber(0)))
            .doOnError(throwable -> System.out.println(throwable.getMessage()));

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(observer);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext(protoNum(9))
            .verifyComplete();

    await().atMost(org.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS).untilTrue(requestWasCanceled);

    assertThat(requestWasCanceled.get()).isTrue();
    assertThat(requestDidProduce.get()).isTrue();
}
 
Example 17
Source File: CancellationPropagationIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void serverCanCancelClientStreamExplicitlyBidi() {
    serverRule.getServiceRegistry().addService(service);

    ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(serverRule.getChannel());

    service.setExplicitCancel(true);

    AtomicBoolean requestWasCanceled = new AtomicBoolean(false);
    AtomicBoolean requestDidProduce = new AtomicBoolean(false);

    Flux<NumberProto.Number> request = Flux
            .fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELEMENTS)::iterator)
            .delayElements(Duration.ofMillis(SEQUENCE_DELAY_MILLIS))
            .map(CancellationPropagationIntegrationTest::protoNum)
            .doOnNext(n -> {
                requestDidProduce.set(true);
                System.out.println("P: " + n.getNumber(0));
            })
            .doOnCancel(() -> {
                requestWasCanceled.set(true);
                System.out.println("Client canceled");
            });

    if (!expectFusion) {
        request = request.hide();
    }

    Flux<NumberProto.Number> observer = request.transform(stub::twoWayPressure)
            .doOnNext(number -> System.out.println(number.getNumber(0)))
            .doOnError(throwable -> System.out.println(throwable.getMessage()));

    StepVerifier.Step<NumberProto.Number> stepVerifier = StepVerifier.create(observer);

    if (expectFusion) {
        stepVerifier = ((StepVerifier.FirstStep<NumberProto.Number>) stepVerifier).expectFusion();
    }

    stepVerifier
            .expectNext(protoNum(-1))
            .verifyComplete();

    await().atMost(org.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS).untilTrue(requestWasCanceled);

    assertThat(requestWasCanceled.get()).isTrue();
    assertThat(requestDidProduce.get()).isTrue();
}
 
Example 18
Source File: BaseOperatorTest.java    From reactor-core with Apache License 2.0 4 votes vote down vote up
final StepVerifier.Step<O> inputFused(OperatorScenario<I, PI, O, PO> scenario) {
	return StepVerifier.create(scenario.body().apply(anySource(scenario)));
}
 
Example 19
Source File: AbstractDecoderTestCase.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Test a standard {@link Decoder#decodeToMono) decode} scenario. For example:
 * <pre class="code">
 * byte[] bytes1 = ...
 * byte[] bytes2 = ...
 * byte[] allBytes = ... // bytes1 + bytes2
 *
 * Flux&lt;DataBuffer&gt; input = Flux.concat(
 *   dataBuffer(bytes1),
 *   dataBuffer(bytes2));
 *
 * testDecodeAll(input, byte[].class, step -&gt; step
 *   .consumeNextWith(expectBytes(allBytes))
 * 	 .verifyComplete());
 * </pre>
 *
 * @param input the input to be provided to the decoder
 * @param outputType the desired output type
 * @param stepConsumer a consumer to {@linkplain StepVerifier verify} the output
 * @param mimeType the mime type to use for decoding. May be {@code null}.
 * @param hints the hints used for decoding. May be {@code null}.
 * @param <T> the output type
 */
@SuppressWarnings("unchecked")
protected <T> void testDecodeToMono(Publisher<DataBuffer> input, ResolvableType outputType,
		Consumer<StepVerifier.FirstStep<T>> stepConsumer,
		@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {

	Mono<T> result = (Mono<T>) this.decoder.decodeToMono(input, outputType, mimeType, hints);
	StepVerifier.FirstStep<T> step = StepVerifier.create(result);
	stepConsumer.accept(step);
}
 
Example 20
Source File: AbstractDecoderTestCase.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Test a standard {@link Decoder#decode decode} scenario. For example:
 * <pre class="code">
 * byte[] bytes1 = ...
 * byte[] bytes2 = ...
 *
 * Flux&lt;DataBuffer&gt; input = Flux.concat(
 *   dataBuffer(bytes1),
 *   dataBuffer(bytes2));
 *
 * testDecodeAll(input, byte[].class, step -&gt; step
 *   .consumeNextWith(expectBytes(bytes1))
 *   .consumeNextWith(expectBytes(bytes2))
 * 	 .verifyComplete());
 * </pre>
 *
 * @param input the input to be provided to the decoder
 * @param outputType the desired output type
 * @param stepConsumer a consumer to {@linkplain StepVerifier verify} the output
 * @param mimeType the mime type to use for decoding. May be {@code null}.
 * @param hints the hints used for decoding. May be {@code null}.
 * @param <T> the output type
 */
@SuppressWarnings("unchecked")
protected <T> void testDecode(Publisher<DataBuffer> input, ResolvableType outputType,
		Consumer<StepVerifier.FirstStep<T>> stepConsumer,
		@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {

	Flux<T> result = (Flux<T>) this.decoder.decode(input, outputType, mimeType, hints);
	StepVerifier.FirstStep<T> step = StepVerifier.create(result);
	stepConsumer.accept(step);
}