Merge branch '6.0.x'

This commit is contained in:
Arjen Poutsma
2023-11-15 14:33:55 +01:00
2 changed files with 12 additions and 5 deletions

View File

@@ -796,10 +796,6 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
if (!(bufferFactory instanceof Netty5DataBufferFactory)) {
assertThat(result).isEqualTo(new byte[]{'b', 'c'});
}
else {
assertThat(result).isEqualTo(new byte[]{'b', 0});
release(slice);
}
release(buffer);
}
@@ -938,4 +934,15 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
release(buffer);
}
@ParameterizedDataBufferAllocatingTest // gh-31605
void shouldHonorSourceBuffersReadPosition(DataBufferFactory bufferFactory) {
DataBuffer dataBuffer = bufferFactory.wrap("ab".getBytes(StandardCharsets.UTF_8));
dataBuffer.readPosition(1);
ByteBuffer byteBuffer = ByteBuffer.allocate(dataBuffer.readableByteCount());
dataBuffer.toByteBuffer(byteBuffer);
assertThat(StandardCharsets.UTF_8.decode(byteBuffer).toString()).isEqualTo("b");
}
}