MySQLFieldCountPacket implements MySQLPacket { @Override public void write(final MySQLPacketPayload payload) { payload.writeIntLenenc(columnCount); } MySQLFieldCountPacket(final MySQLPacketPayload payload); @Override void write(final MySQLPacketPayload payload);  }
@Test public void assertWrite() { when(payload.readInt1()).thenReturn(1, 3); MySQLFieldCountPacket actual = new MySQLFieldCountPacket(payload); assertThat(actual.getSequenceId(), is(1)); assertThat(actual.getColumnCount(), is(3)); actual.write(payload); verify(payload).writeIntLenenc(3); }