### Question:
Grid implements Iterable<Grid.Point> { @Override public Iterator<Point> iterator() { return new GridIterator(this); } Grid(final int padding,
                final int iconSize,
                final int rows,
                final int cols); Point findPosition(final Point anchorPoint,
                              final Direction direction); Point findPosition(final int row,
                              final int col); @Override Iterator<Point> iterator(); int getRows(); int getCols(); int size(); int getWidth(); int getHeight();  }### Answer:
@Test public void testIterator() { Iterator iterator = grid.iterator(); int cellCount = 0; while (iterator.hasNext()) { iterator.next(); cellCount++; } assertEquals(grid.size(), cellCount); }
@Test(expected = NoSuchElementException.class) public void testIteratorOverflow() { Iterator iterator = grid.iterator(); while (iterator.hasNext()) { iterator.next(); } iterator.next(); }
@Test(expected = UnsupportedOperationException.class) public void testIteratorRemoveNotSupported() { grid.iterator().remove(); }