Merge branch '5.1.x'

This commit is contained in:
Brian Clozel
2019-03-04 13:58:41 +01:00
2 changed files with 23 additions and 2 deletions

View File

@@ -225,6 +225,27 @@ public class DataBufferTests extends AbstractDataBufferAllocatingTestCase {
release(buffer);
}
@Test
public void writeMultipleUtf8String() {
DataBuffer buffer = createDataBuffer(1);
buffer.write("abc", StandardCharsets.UTF_8);
assertEquals(3, buffer.readableByteCount());
buffer.write("def", StandardCharsets.UTF_8);
assertEquals(6, buffer.readableByteCount());
buffer.write("ghi", StandardCharsets.UTF_8);
assertEquals(9, buffer.readableByteCount());
byte[] result = new byte[9];
buffer.read(result);
assertArrayEquals("abcdefghi".getBytes(), result);
release(buffer);
}
@Test
public void inputStream() throws IOException {
DataBuffer buffer = createDataBuffer(4);