}
assertCsvTable(table);
}
public void testMultiTableWrite() {
MultiCsvTable multi = createMultiCsvTable();
Iterator<String[]> entities = multi.getEntities();
int rows = 0;
int tables = 0;
while (entities.hasNext()) {
String[] next = entities.next();
switch (rows) {
case 0:
++tables;
assertTrue(Arrays.deepEquals(TABLE1_HEADER, next));
break;
case 1:
assertTrue(Arrays.deepEquals(TABLE1_ROW1, next));
break;
case 2:
assertTrue(Arrays.deepEquals(TABLE1_ROW2, next));
break;
case 3:
assertTrue(Arrays.deepEquals(TABLE1_ROW3, next));
break;
case 4:
assertTrue(Arrays.deepEquals(EMPTY_ROW, next));
break;
// table 2
case 5:
++tables;
assertTrue(Arrays.deepEquals(TABLE2_HEADER, next));
break;
case 6:
assertTrue(Arrays.deepEquals(TABLE2_ROW1, next));
break;
case 7:
assertTrue(Arrays.deepEquals(TABLE2_ROW2, next));
break;
case 8:
assertTrue(Arrays.deepEquals(EMPTY_ROW, next));
break;
// table 3
case 9:
++tables;
assertTrue(Arrays.deepEquals(TABLE3_ROW1, next));
break;
case 10:
assertTrue(Arrays.deepEquals(TABLE3_ROW2, next));
break;
default:
fail("too many rows");
}
++rows;
}
assertEquals(tables, multi.getTables().size());
assertEquals(rows, 11);
}