@Test
  public void isValidForGrid() {
    RectangularViewportDefinition viewportCells =
        new RectangularViewportDefinition(
            0, ImmutableList.of(3, 4, 6), ImmutableList.of(8, 10), TypeFormatter.Format.EXPANDED);
    GridStructure validStructure = mock(GridStructure.class);
    stub(validStructure.getColumnCount()).toReturn(20);
    stub(validStructure.getRowCount()).toReturn(10);
    assertTrue(viewportCells.isValidFor(validStructure));

    GridStructure invalidColumns = mock(GridStructure.class);
    stub(invalidColumns.getColumnCount()).toReturn(5);
    stub(invalidColumns.getRowCount()).toReturn(10);
    assertFalse(viewportCells.isValidFor(invalidColumns));

    GridStructure invalidRows = mock(GridStructure.class);
    stub(invalidRows.getColumnCount()).toReturn(15);
    stub(invalidRows.getRowCount()).toReturn(5);
    assertFalse(viewportCells.isValidFor(invalidRows));
  }
 @Test
 public void iterator() {
   RectangularViewportDefinition viewportCells =
       new RectangularViewportDefinition(
           0,
           ImmutableList.of(3, 4, 6),
           ImmutableList.of(8, 10, 11),
           TypeFormatter.Format.EXPANDED);
   ImmutableList<GridCell> gridCells = ImmutableList.copyOf(viewportCells.iterator());
   List<GridCell> expectedCells =
       ImmutableList.of(
           new GridCell(3, 8),
           new GridCell(3, 10),
           new GridCell(3, 11),
           new GridCell(4, 8),
           new GridCell(4, 10),
           new GridCell(4, 11),
           new GridCell(6, 8),
           new GridCell(6, 10),
           new GridCell(6, 11));
   assertEquals(expectedCells, gridCells);
 }