public static SQLException toSQLException(final Exception cause, final DatabaseType databaseType) {
        if (cause instanceof SQLException) {
            return (SQLException) cause;
        }
        if (cause instanceof ShardingSphereSQLException) {
            return ((ShardingSphereSQLException) cause).toSQLException();
        }
        if (cause instanceof SQLDialectException) {
            if (cause instanceof DatabaseProtocolException) {
                return new DatabaseProtocolSQLException(cause.getMessage()).toSQLException();
            }
            Optional<SQLDialectExceptionMapper> dialectExceptionMapper = DatabaseTypedSPILoader.findService(SQLDialectExceptionMapper.class, databaseType);
            if (dialectExceptionMapper.isPresent()) {
                return dialectExceptionMapper.get().convert((SQLDialectException) cause);
            }
        }
        if (cause instanceof ShardingSphereServerException) {
            return new ServerSQLException(cause).toSQLException();
        }
        return new UnknownSQLException(cause).toSQLException();
    }
@Test
    void assertToSQLExceptionWithSQLException() {
        SQLException cause = new SQLException("");
        assertThat(SQLExceptionTransformEngine.toSQLException(cause, databaseType), is(cause));
    }