protected void assertContents(String xml, boolean hasHeader, boolean doesPercents) {
        // Ignore anything before the first <tr>
        // Ignore the header row if there is one
        int ignores = 1;
        if (hasHeader) {
            ignores++;
        }

        // Split into rows, and discard the row closing (and anything after)
        String[] rows = xml.split("<tr>");
        rows = Arrays.copyOfRange(rows, ignores, rows.length);
        for (int i = 0; i < rows.length; i++) {
            rows[i] = rows[i].split("</tr>")[0].trim();
        }

        // Check we got the right number of rows
        for (int cn = 0; cn < table.length; cn++) {
            assertEquals(table[cn].length, rows.length,
                    "Wrong number of rows found compared to column " + (cn + 1));
        }

        // Check each row's values
        for (int rn = 0; rn < rows.length; rn++) {
            String[] cells = toCells(rows[rn], false);
            assertEquals(table.length, cells.length,
                    "Wrong number of values in row " + (rn + 1));

            for (int cn = 0; cn < table.length; cn++) {
                String val = cells[cn];

                // If the parser doesn't know about % formats,
                //  skip the cell if the column in a % one
                if (!doesPercents && percentageColumns.contains(cn)) {
                    continue;
                }

                // Ignore cell attributes
                if (!val.isEmpty()) {
                    val = val.split(">")[1];
                }
                // Check
                String error = "Wrong text in row " + (rn + 1) + " and column " + (cn + 1) + " - " +
                        table[cn][rn] + " vs " + val;
                if (table[cn][rn] instanceof String) {
                    assertEquals(table[cn][rn], val, error);
                } else {
                    assertTrue(((Pattern) table[cn][rn]).matcher(val).matches(), error);
                }
            }
        }
    }
Expected values, by <em>column</em>
tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/TabularFormatsTest.java