Polishing contribution
Closes gh-29310
This commit is contained in:
@@ -524,7 +524,6 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void asByteBufferIndexLength(DataBufferFactory bufferFactory) {
|
||||
super.bufferFactory = bufferFactory;
|
||||
|
||||
@@ -534,12 +533,10 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
ByteBuffer result = buffer.asByteBuffer(1, 2);
|
||||
assertThat(result.capacity()).isEqualTo(2);
|
||||
|
||||
boolean isNetty5DataBufferFactory = bufferFactory instanceof Netty5DataBufferFactory;
|
||||
if (isNetty5DataBufferFactory) {
|
||||
assumeFalse(bufferFactory instanceof Netty5DataBufferFactory, () -> {
|
||||
DataBufferUtils.release(buffer);
|
||||
}
|
||||
|
||||
assumeFalse(isNetty5DataBufferFactory, "Netty 5 does share the internal buffer");
|
||||
return "Netty 5 does share the internal buffer";
|
||||
});
|
||||
|
||||
buffer.write((byte) 'c');
|
||||
assertThat(result.remaining()).isEqualTo(2);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -208,12 +208,12 @@ public abstract class AbstractDecoderTests<D extends Decoder<?>> extends Abstrac
|
||||
protected void testDecodeError(Publisher<DataBuffer> input, ResolvableType outputType,
|
||||
@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
|
||||
|
||||
Flux<DataBuffer> buffer = Mono.from(input).concatWith(Flux.error(new InputException()));
|
||||
Flux<DataBuffer> flux = Mono.from(input).concatWith(Flux.error(new InputException()));
|
||||
assertThatExceptionOfType(InputException.class).isThrownBy(() ->
|
||||
this.decoder.decode(buffer, outputType, mimeType, hints)
|
||||
.doOnNext(o -> {
|
||||
if (o instanceof Buffer buf) {
|
||||
buf.close();
|
||||
this.decoder.decode(flux, outputType, mimeType, hints)
|
||||
.doOnNext(object -> {
|
||||
if (object instanceof Buffer buffer) {
|
||||
buffer.close();
|
||||
}
|
||||
})
|
||||
.blockLast(Duration.ofSeconds(5)));
|
||||
@@ -234,9 +234,9 @@ public abstract class AbstractDecoderTests<D extends Decoder<?>> extends Abstrac
|
||||
@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
|
||||
|
||||
Flux<?> result = this.decoder.decode(input, outputType, mimeType, hints)
|
||||
.doOnNext(o -> {
|
||||
if (o instanceof Buffer buf) {
|
||||
buf.close();
|
||||
.doOnNext(object -> {
|
||||
if (object instanceof Buffer buffer) {
|
||||
buffer.close();
|
||||
}
|
||||
});
|
||||
StepVerifier.create(result).expectNextCount(1).thenCancel().verify();
|
||||
|
||||
Reference in New Issue
Block a user