public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload,
                                                 final ConnectionSession connectionSession) {
        switch (commandPacketType) {
            case COM_QUIT:
                return new MySQLComQuitPacket();
            case COM_INIT_DB:
                return new MySQLComInitDbPacket(payload);
            case COM_FIELD_LIST:
                return new MySQLComFieldListPacket(payload);
            case COM_QUERY:
                return new MySQLComQueryPacket(payload);
            case COM_STMT_PREPARE:
                return new MySQLComStmtPreparePacket(payload);
            case COM_STMT_EXECUTE:
                MySQLServerPreparedStatement serverPreparedStatement =
                        connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(payload.getByteBuf().getIntLE(payload.getByteBuf().readerIndex()));
                return new MySQLComStmtExecutePacket(payload, serverPreparedStatement.getSqlStatementContext().getSqlStatement().getParameterCount());
            case COM_STMT_SEND_LONG_DATA:
                return new MySQLComStmtSendLongDataPacket(payload);
            case COM_STMT_RESET:
                return new MySQLComStmtResetPacket(payload);
            case COM_STMT_CLOSE:
                return new MySQLComStmtClosePacket(payload);
            case COM_SET_OPTION:
                return new MySQLComSetOptionPacket(payload);
            case COM_PING:
                return new MySQLComPingPacket();
            case COM_RESET_CONNECTION:
                return new MySQLComResetConnectionPacket();
            default:
                return new MySQLUnsupportedCommandPacket(commandPacketType);
        }
    }
@Test
    void assertNewInstanceWithComStmtSendLongDataPacket() {
        assertThat(MySQLCommandPacketFactory.newInstance(MySQLCommandPacketType.COM_STMT_SEND_LONG_DATA, payload, connectionSession), instanceOf(MySQLComStmtSendLongDataPacket.class));
    }