From ec4f8b59c91472f461a7dec078194713daeb753b Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 1 Sep 2020 20:50:49 +0100 Subject: [PATCH] Use default ByteBufAllocator in unit tests Signed-off-by: Graham --- .../openrs2/buffer/ByteBufExtensionsTest.kt | 67 ++++++++++--------- .../openrs2/cache/BufferedFileChannelTest.kt | 47 ++++++------- .../java/dev/openrs2/cache/Js5IndexTest.kt | 23 ++++--- 3 files changed, 70 insertions(+), 67 deletions(-) diff --git a/buffer/src/test/java/dev/openrs2/buffer/ByteBufExtensionsTest.kt b/buffer/src/test/java/dev/openrs2/buffer/ByteBufExtensionsTest.kt index 97e65add..f2d55591 100644 --- a/buffer/src/test/java/dev/openrs2/buffer/ByteBufExtensionsTest.kt +++ b/buffer/src/test/java/dev/openrs2/buffer/ByteBufExtensionsTest.kt @@ -1,5 +1,6 @@ package dev.openrs2.buffer +import io.netty.buffer.ByteBufAllocator import io.netty.buffer.Unpooled import org.junit.jupiter.api.assertThrows import kotlin.test.Test @@ -48,61 +49,61 @@ object ByteBufExtensionsTest { @Test fun testWriteShortSmart() { Unpooled.wrappedBuffer(byteArrayOf(0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(-0x40) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x40)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(0) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x7F)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(0x3F) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x80.toByte(), 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(-0x4000) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xBF.toByte(), 0xBF.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(-0x41) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x40.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(0x40) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xFF.toByte(), 0xFF.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeShortSmart(0x3FFF) assertEquals(expected, actual) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeShortSmart(-0x4001) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeShortSmart(0x4000) } @@ -145,54 +146,54 @@ object ByteBufExtensionsTest { @Test fun testWriteUnsignedShortSmart() { Unpooled.wrappedBuffer(byteArrayOf(0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x40)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0x40) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x7F)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0x7F) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x80.toByte(), 0x80.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0x80) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0x4000) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xFF.toByte(), 0xFF.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedShortSmart(0x7FFF) assertEquals(expected, actual) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeUnsignedShortSmart(-0x1) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeUnsignedShortSmart(0x10000) } @@ -240,28 +241,28 @@ object ByteBufExtensionsTest { @Test fun testWriteIntSmart() { Unpooled.wrappedBuffer(byteArrayOf(0x00, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(-0x4000) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x40, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(0) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x7F, 0xFF.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(0x3FFF) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x80.toByte(), 0x00, 0x00, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(-0x40000000) assertEquals(expected, actual) } @@ -270,14 +271,14 @@ object ByteBufExtensionsTest { Unpooled.wrappedBuffer( byteArrayOf(0xBF.toByte(), 0xFF.toByte(), 0xBF.toByte(), 0xFF.toByte()) ).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(-0x4001) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x00, 0x40.toByte(), 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(0x4000) assertEquals(expected, actual) } @@ -286,19 +287,19 @@ object ByteBufExtensionsTest { Unpooled.wrappedBuffer( byteArrayOf(0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte()) ).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeIntSmart(0x3FFFFFFF) assertEquals(expected, actual) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeIntSmart(-0x40000001) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeIntSmart(0x40000000) } @@ -341,35 +342,35 @@ object ByteBufExtensionsTest { @Test fun testWriteUnsignedIntSmart() { Unpooled.wrappedBuffer(byteArrayOf(0x00, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x40, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0x4000) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x7F, 0xFF.toByte())).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0x7FFF) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0x80.toByte(), 0x00, 0x80.toByte(), 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0x8000) assertEquals(expected, actual) } } Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x00, 0x00, 0x00)).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0x40000000) assertEquals(expected, actual) } @@ -378,13 +379,13 @@ object ByteBufExtensionsTest { Unpooled.wrappedBuffer( byteArrayOf(0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte()) ).use { expected -> - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> actual.writeUnsignedIntSmart(0x7FFFFFFF) assertEquals(expected, actual) } } - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { buf.writeUnsignedIntSmart(0x80000000.toInt()) } diff --git a/cache/src/test/java/dev/openrs2/cache/BufferedFileChannelTest.kt b/cache/src/test/java/dev/openrs2/cache/BufferedFileChannelTest.kt index 01774fd3..e16537e6 100644 --- a/cache/src/test/java/dev/openrs2/cache/BufferedFileChannelTest.kt +++ b/cache/src/test/java/dev/openrs2/cache/BufferedFileChannelTest.kt @@ -3,6 +3,7 @@ package dev.openrs2.cache import com.google.common.jimfs.Configuration import com.google.common.jimfs.Jimfs import dev.openrs2.buffer.use +import io.netty.buffer.ByteBufAllocator import io.netty.buffer.Unpooled import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -155,7 +156,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ), 8, 8).use { channel -> - Unpooled.buffer(7, 7).use { actual -> + ByteBufAllocator.DEFAULT.buffer(7, 7).use { actual -> Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { expected -> channel.read(0, actual, actual.writableBytes()) assertEquals(expected, actual) @@ -177,7 +178,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ), 8, 8).use { channel -> - Unpooled.buffer(14, 14).use { actual -> + ByteBufAllocator.DEFAULT.buffer(14, 14).use { actual -> Unpooled.wrappedBuffer("OpenRS2OpenRS2".toByteArray()).use { expected -> channel.read(0, actual, actual.writableBytes()) assertEquals(expected, actual) @@ -193,7 +194,7 @@ object BufferedFileChannelTest { val path = fs.getPath("/test.dat") BufferedFileChannel(FileChannel.open(path, CREATE, READ, WRITE), 8, 8).use { channel -> - Unpooled.buffer(1, 1).use { buf -> + ByteBufAllocator.DEFAULT.buffer(1, 1).use { buf -> assertThrows { channel.read(0, buf, buf.writableBytes()) } @@ -209,7 +210,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ), 8, 8).use { channel -> - Unpooled.buffer(15, 15).use { buf -> + ByteBufAllocator.DEFAULT.buffer(15, 15).use { buf -> assertThrows { channel.read(0, buf, buf.writableBytes()) } @@ -228,7 +229,7 @@ object BufferedFileChannelTest { channel.write(7, buf, buf.readableBytes()) } - Unpooled.buffer(8, 8).use { actual -> + ByteBufAllocator.DEFAULT.buffer(8, 8).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer(byteArrayOf(0, 0, 0, 0, 0, 0, 0, 1)).use { expected -> @@ -249,7 +250,7 @@ object BufferedFileChannelTest { channel.write(0, buf, buf.readableBytes()) } - Unpooled.buffer(7, 7).use { actual -> + ByteBufAllocator.DEFAULT.buffer(7, 7).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer("OpenRS2".toByteArray()).use { expected -> @@ -270,7 +271,7 @@ object BufferedFileChannelTest { channel.write(0, buf, buf.readableBytes()) } - Unpooled.buffer(6, 6).use { actual -> + ByteBufAllocator.DEFAULT.buffer(6, 6).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer("OpenRS".toByteArray()).use { expected -> @@ -291,7 +292,7 @@ object BufferedFileChannelTest { channel.write(0, buf, buf.readableBytes()) } - Unpooled.buffer(6, 6).use { actual -> + ByteBufAllocator.DEFAULT.buffer(6, 6).use { actual -> channel.read(1, actual, actual.writableBytes()) Unpooled.wrappedBuffer("penRS2".toByteArray()).use { expected -> @@ -314,7 +315,7 @@ object BufferedFileChannelTest { channel.write(4, buf, buf.readableBytes()) } - Unpooled.buffer(14, 14).use { actual -> + ByteBufAllocator.DEFAULT.buffer(14, 14).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer("OpenHelloenRS2".toByteArray()).use { expected -> @@ -337,7 +338,7 @@ object BufferedFileChannelTest { channel.write(4, buf, buf.readableBytes()) } - Unpooled.buffer(7, 7).use { actual -> + ByteBufAllocator.DEFAULT.buffer(7, 7).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer("OpenHel".toByteArray()).use { expected -> @@ -360,7 +361,7 @@ object BufferedFileChannelTest { channel.write(4, buf, buf.readableBytes()) } - Unpooled.buffer(7, 7).use { actual -> + ByteBufAllocator.DEFAULT.buffer(7, 7).use { actual -> channel.read(7, actual, actual.writableBytes()) Unpooled.wrappedBuffer("loenRS2".toByteArray()).use { expected -> @@ -383,7 +384,7 @@ object BufferedFileChannelTest { channel.write(4, buf, buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(0, actual, actual.writableBytes()) Unpooled.wrappedBuffer("Open".toByteArray()).use { expected -> @@ -391,7 +392,7 @@ object BufferedFileChannelTest { } } - Unpooled.buffer(5, 5).use { actual -> + ByteBufAllocator.DEFAULT.buffer(5, 5).use { actual -> channel.read(9, actual, actual.writableBytes()) Unpooled.wrappedBuffer("enRS2".toByteArray()).use { expected -> @@ -410,7 +411,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ, WRITE), 4, 0).use { channel -> - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RS2O".toByteArray()).use { expected -> @@ -422,7 +423,7 @@ object BufferedFileChannelTest { channel.write(4, buf.slice(), buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("ABCD".toByteArray()).use { expected -> @@ -441,7 +442,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ, WRITE), 4, 0).use { channel -> - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RS2O".toByteArray()).use { expected -> @@ -453,7 +454,7 @@ object BufferedFileChannelTest { channel.write(4, buf.slice(), buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("ABCO".toByteArray()).use { expected -> @@ -472,7 +473,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ, WRITE), 4, 0).use { channel -> - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RS2O".toByteArray()).use { expected -> @@ -484,7 +485,7 @@ object BufferedFileChannelTest { channel.write(5, buf.slice(), buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RBCD".toByteArray()).use { expected -> @@ -503,7 +504,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ, WRITE), 4, 0).use { channel -> - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RS2O".toByteArray()).use { expected -> @@ -515,7 +516,7 @@ object BufferedFileChannelTest { channel.write(3, buf.slice(), buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("ABCD".toByteArray()).use { expected -> @@ -534,7 +535,7 @@ object BufferedFileChannelTest { Files.write(path, "OpenRS2OpenRS2".toByteArray()) BufferedFileChannel(FileChannel.open(path, READ, WRITE), 4, 0).use { channel -> - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("RS2O".toByteArray()).use { expected -> @@ -546,7 +547,7 @@ object BufferedFileChannelTest { channel.write(4, buf.slice(), buf.readableBytes()) } - Unpooled.buffer(4, 4).use { actual -> + ByteBufAllocator.DEFAULT.buffer(4, 4).use { actual -> channel.read(4, actual, actual.writableBytes()) Unpooled.wrappedBuffer("ABCD".toByteArray()).use { expected -> diff --git a/cache/src/test/java/dev/openrs2/cache/Js5IndexTest.kt b/cache/src/test/java/dev/openrs2/cache/Js5IndexTest.kt index 38ee0d12..3faee4bd 100644 --- a/cache/src/test/java/dev/openrs2/cache/Js5IndexTest.kt +++ b/cache/src/test/java/dev/openrs2/cache/Js5IndexTest.kt @@ -3,6 +3,7 @@ package dev.openrs2.cache import dev.openrs2.buffer.use import dev.openrs2.util.krHashCode import io.netty.buffer.ByteBuf +import io.netty.buffer.ByteBufAllocator import io.netty.buffer.ByteBufUtil import io.netty.buffer.Unpooled import org.junit.jupiter.api.assertThrows @@ -116,7 +117,7 @@ object Js5IndexTest { @Test fun testWriteEmpty() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> emptyIndex.write(actual) read("empty.dat").use { expected -> @@ -151,7 +152,7 @@ object Js5IndexTest { @Test fun testWriteVersioned() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> versionedIndex.write(actual) read("versioned.dat").use { expected -> @@ -171,7 +172,7 @@ object Js5IndexTest { @Test fun testWriteNoFlags() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> noFlagsIndex.write(actual) read("no-flags.dat").use { expected -> @@ -191,7 +192,7 @@ object Js5IndexTest { @Test fun testWriteNamed() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> namedIndex.write(actual) read("named.dat").use { expected -> @@ -211,7 +212,7 @@ object Js5IndexTest { @Test fun testWriteSmart() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> smartIndex.write(actual) read("smart.dat").use { expected -> @@ -225,7 +226,7 @@ object Js5IndexTest { val index = Js5Index(Js5Protocol.ORIGINAL) index.createOrGet(65536) - Unpooled.buffer().use { buf -> + ByteBufAllocator.DEFAULT.buffer().use { buf -> assertThrows { index.write(buf) } @@ -243,7 +244,7 @@ object Js5IndexTest { @Test fun testWriteDigest() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> digestIndex.write(actual) read("digest.dat").use { expected -> @@ -254,7 +255,7 @@ object Js5IndexTest { @Test fun testWriteNullDigest() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> nullDigestIndex.write(actual) read("null-digest.dat").use { expected -> @@ -274,7 +275,7 @@ object Js5IndexTest { @Test fun testWriteLengths() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> lengthsIndex.write(actual) read("lengths.dat").use { expected -> @@ -294,7 +295,7 @@ object Js5IndexTest { @Test fun testWriteUncompressedChecksum() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> uncompressedChecksumIndex.write(actual) read("uncompressed-checksum.dat").use { expected -> @@ -314,7 +315,7 @@ object Js5IndexTest { @Test fun testWriteAllFlags() { - Unpooled.buffer().use { actual -> + ByteBufAllocator.DEFAULT.buffer().use { actual -> allFlagsIndex.write(actual) read("all-flags.dat").use { expected ->