MySQLAuthSwitchRequestPacket implements MySQLPacket { @Override public void write(final MySQLPacketPayload payload) { payload.writeInt1(0xfe); payload.writeStringNul(authPluginName); payload.writeStringNul(new String(authPluginData.getAuthPluginData())); }  @Override void write(final MySQLPacketPayload payload);  }
@Test public void assertWrite() { when(authPluginData.getAuthPluginData()).thenReturn(new byte[] {0x11, 0x22}); MySQLAuthSwitchRequestPacket authSwitchRequestPacket = new MySQLAuthSwitchRequestPacket(1, "plugin", authPluginData); authSwitchRequestPacket.write(payload); verify(payload).writeInt1(0xfe); verify(payload, times(2)).writeStringNul(anyString()); }