RectangularViewportDefinition extends ViewportDefinition { @Override public Iterator<GridCell> iterator() { return new CellIterator(); } RectangularViewportDefinition(int version,
                                              List<Integer> rows,
                                              List<Integer> columns,
                                              TypeFormatter.Format format,
                                              Boolean enableLogging); @Override Iterator<GridCell> iterator(); @Override boolean isValidFor(GridStructure grid); @Override String toString();  }
@Test public void iterator() { RectangularViewportDefinition viewportCells = new RectangularViewportDefinition(0, ImmutableList.of(3, 4, 6), ImmutableList.of(8, 10, 11), TypeFormatter.Format.EXPANDED, false); ImmutableList<GridCell> gridCells = ImmutableList.copyOf(viewportCells.iterator()); List<GridCell> expectedCells = ImmutableList.of( new GridCell(3, 8, TypeFormatter.Format.EXPANDED), new GridCell(3, 10, TypeFormatter.Format.EXPANDED), new GridCell(3, 11, TypeFormatter.Format.EXPANDED), new GridCell(4, 8, TypeFormatter.Format.EXPANDED), new GridCell(4, 10, TypeFormatter.Format.EXPANDED), new GridCell(4, 11, TypeFormatter.Format.EXPANDED), new GridCell(6, 8, TypeFormatter.Format.EXPANDED), new GridCell(6, 10, TypeFormatter.Format.EXPANDED), new GridCell(6, 11, TypeFormatter.Format.EXPANDED)); assertEquals(expectedCells, gridCells); }