public void checkResult(List<String> expectedResult, String table, int fieldsLen)
            throws SQLException, ClassNotFoundException {
        Class.forName(driverClass);
        try (Connection dbConn = DriverManager.getConnection(url, userName, password);
                PreparedStatement statement = dbConn.prepareStatement("select * from " + table);
                ResultSet resultSet = statement.executeQuery()) {
            List<String> results = new ArrayList<>();
            while (resultSet.next()) {
                List<String> result = new ArrayList<>();
                for (int fieldIndex = 1; fieldIndex <= fieldsLen; fieldIndex++) {
                    Object value = resultSet.getObject(fieldIndex);
                    if (value == null) {
                        result.add("null");
                    } else {
                        result.add(value.toString());
                    }
                }

                results.add(StringUtils.join(result, ","));
            }
            Collections.sort(results);
            Collections.sort(expectedResult);
            assertEquals(expectedResult, results);
        }
    }
Compare db select result and expected result in one time.
@param expectedResult
@param table
@param fieldsLen
@throws SQLException
@throws ClassNotFoundException
inlong-sort/sort-end-to-end-tests/sort-end-to-end-tests-v1.13/src/test/java/org/apache/inlong/sort/tests/utils/JdbcProxy.java