* @param expected The expected row values.
* @param index The starting data set row index where the comparison starts.
*/
public static void assertDataSetValues(DataSet dataSet, String[][] expected, int index) {
Locale locale = Locale.ENGLISH;
DataFormatterRegistry dataFormatterRegistry = DataFormatterRegistry.lookup();
// Check size
assertThat(dataSet.getRowCount()).isGreaterThan(index);
for (int i = index; i < expected.length; i++) {
String[] row = expected[i];
// Check row values
for (int j = 0; j < row.length; j++) {
Object dataSetValue = dataSet.getValueAt(i, j);
DataProperty prop = dataSet.getPropertyByColumn(j);
String expectedValue = row[j];
if (expectedValue == null) continue;
// Compare the data set value with the value the user is expecting to see.
DataPropertyFormatter propFormatter = dataFormatterRegistry.getPropertyFormatter(prop.getPropertyId());
String displayedValue = propFormatter.formatValue(prop, dataSetValue, locale);
if (!displayedValue.equals(expectedValue)) {
fail("Data set value [" + i + "," + j + "] is different. " +
"Column=\"" + prop.getPropertyId() + "\" " +
"Actual=\"" + displayedValue + "\" Expected=\"" + expectedValue + "\"");