Tweak OutPacket

This commit is contained in:
P0nk
2021-08-20 12:18:59 +02:00
parent e93428f457
commit d8b0929975
5 changed files with 34 additions and 10 deletions

View File

@@ -143,7 +143,7 @@ class ByteBufOutPacketTest {
@Test
void writeBoolean_true() {
outPacket.writeBoolean(true);
outPacket.writeBool(true);
ByteBuf wrapped = wrapExplicitlyWrittenBytes(outPacket);
byte readByte = wrapped.readByte();
@@ -153,7 +153,7 @@ class ByteBufOutPacketTest {
@Test
void writeBoolean_false() {
outPacket.writeBoolean(false);
outPacket.writeBool(false);
ByteBuf wrapped = wrapExplicitlyWrittenBytes(outPacket);
byte readByte = wrapped.readByte();
@@ -203,4 +203,15 @@ class ByteBufOutPacketTest {
assertEquals(0, wrapped.readByte());
assertEquals(secondWrittenByte, wrapped.readByte());
}
@Test
void whenGettingBytesRepeatedly_bytesShouldBeLockedInPlace() {
outPacket.writeByte(1);
byte[] initialWrite = outPacket.getBytes();
outPacket.writeByte(2);
byte[] afterWritingAgain = outPacket.getBytes();
assertArrayEquals(initialWrite, afterWritingAgain);
}
}