### Question:
RuneliteBuffer { public void runeliteFinishPacket() { if (runeliteLengthOffset > 0) { int length = offset - runeliteLengthOffset - 2; if (length < 0) { return; } payload[runeliteLengthOffset++] = (byte) (length >> 8); payload[runeliteLengthOffset++] = (byte) length; runeliteLengthOffset = 0; } }  int getOffset(); void setOffset(int offset); byte[] getPayload(); void setPayload(byte[] payload); int getRuneliteLengthOffset(); void setRuneliteLengthOffset(int runeliteLengthOffset); byte runeliteReadByte(); short runeliteReadShort(); int runeliteReadInt(); long runeliteReadLong(); String runeliteReadString(); void runeliteWriteByte(byte b); void runeliteWriteShort(short s); void runeliteWriteInt(int i); void runeliteWriteLong(long l); void runeliteWriteString(String s); void runeliteInitPacket(); void runeliteFinishPacket();  }### Answer:
@Test public void testRuneliteFinishPacket() { RuneliteBuffer buffer = new RuneliteBuffer(); byte[] b = new byte[7]; buffer.setPayload(b); buffer.runeliteWriteByte((byte) 0); buffer.runeliteInitPacket(); buffer.runeliteWriteInt(42); assertEquals(0, b[2]); buffer.runeliteFinishPacket(); assertEquals(7, b.length); assertEquals(0, b[0]); assertEquals(0, b[1]); assertEquals(4, b[2]); assertEquals(0, b[3]); assertEquals(0, b[4]); assertEquals(0, b[5]); assertEquals(42, b[6]); }