### Question:
CellGrid { public void setCell(C cell) { setCell(cell.getX(), cell.getY(), cell); } @SuppressWarnings("unchecked") private  CellGrid(GridDef gridDef, CellFactory<? extends C> cellFactory); static CellGrid<C> create(GridDef gridDef, CellFactory<? extends C> cellFactory); int getWidth(); int getHeight(); GridDef getGridDef(); CellFactory<? extends C> getCellFactory(); C getCellSafe(int x, int y); C getCell(int x, int y); void setCell(C cell); void setCell(int x, int y, C cell); C createCell(int x, int y); @SuppressWarnings("unchecked") List<C> getCells(); List<C> getCells(CellFilter<C> filter);  }### Answer:
@Test public void testSetCell() throws Exception { CellGrid<MyCell> grid = createGrid(GridDef.createGlobal(5.0)); assertNull(grid.getCell(6, 18)); MyCell cell = new MyCell(6, 18); grid.setCell(6, 18, cell); assertSame(cell, grid.getCell(6, 18)); assertSame(cell, grid.getCellSafe(6, 18)); }
@Test(expected = IllegalArgumentException.class) public void testSetCellIAE() throws Exception { CellGrid<MyCell> grid = createGrid(GridDef.createGlobal(5.0)); MyCell cell = new MyCell(7, 18); grid.setCell(6, 18, cell); }