@Test public void testIterator() throws Exception {

    TableModel model = new DynamicTableModel(2, 2);
    RectF tableRect = new RectF(0, 0, 1000, 2000);
    // should stop at 4 iterations since the table can only hold that many:
    Iterator<RectF> it = model.getIterator(tableRect, 10);
    int iterations = 0;
    while(it.hasNext()) {
        it.next();
        iterations++;
    }
    assertEquals(4, iterations);
    // now set a dynamic number of columns.  iterations should equal however
    // many elements we throw at it:
    model = new DynamicTableModel(2, 0);
    it = model.getIterator(tableRect, 10);
    iterations = 0;
    while(it.hasNext()) {
        it.next();
        iterations++;
    }
    assertEquals(10, iterations);
}