@Override
    public void print(Iterator<RowData> it, PrintWriter printWriter) {
        if (!it.hasNext()) {
            printEmptyResult(it, printWriter);
            return;
        }
        long numRows = printTable(it, printWriter);
        printFooter(printWriter, numRows);
    }
@Test
    void testPrintWithMultipleRowsAndRowKind() {
        PrintStyle.tableauWithTypeInferredColumnWidths(
                        getSchema(),
                        getConverter(),
                        PrintStyle.DEFAULT_MAX_COLUMN_WIDTH,
                        true,
                        true)
                .print(getData().iterator(), new PrintWriter(outContent));

        // note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean)
        // character's
        // width < 2 in IDE by default, every CJK character usually's width is 2, you can open this
        // source file
        // by vim or just cat the file to check the regular result.
        // The last row of `varchar` value will pad with two ' ' before the column.
        // Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
        // no more Japanese character can be added to the line.
        assertThat(outContent.toString())
                .isEqualTo(
                        "+----+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+"
                                + System.lineSeparator()
                                + "| op | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |"
                                + System.lineSeparator()
                                + "+----+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+"
                                + System.lineSeparator()
                                + "| +I |         |           1 |                    2 |                            abc |        1.23000 | 2020-03-01 18:39:14.000000 |"
                                + System.lineSeparator()
                                + "| +I |   false |             |                    0 |                                |        1.00000 | 2020-03-01 18:39:14.100000 |"
                                + System.lineSeparator()
                                + "| -D |    true |  2147483647 |                      |                        abcdefg |    12345.00000 | 2020-03-01 18:39:14.120000 |"
                                + System.lineSeparator()
                                + "| +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 | 2020-03-01 18:39:14.123000 |"
                                + System.lineSeparator()
                                + "| +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |"
                                + System.lineSeparator()
                                + "| -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |"
                                + System.lineSeparator()
                                + "| +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 | 2020-03-04 18:39:14.000000 |"
                                + System.lineSeparator()
                                + "| -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 | 2020-03-04 18:39:14.000000 |"
                                + System.lineSeparator()
                                + "+----+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+"
                                + System.lineSeparator()
                                + "8 rows in set"
                                + System.lineSeparator());
    }